#include "lxz_config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <errno.h>
#include <fcntl.h>

#ifdef LXZAT_WIN32 
#include <io.h>
#include <wchar.h>
#include <windows.h>
#endif /* LXZAT_WIN32 */ 

#ifdef LXZAT_LINUX
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <linux/sockios.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <pthread.h>
#include <errno.h>
#endif /* LXZAT_LINUX */

#include "lxz_types.h"
#include "os_port.h"
#include "lxz_runlog.h"
#include "lxz_debug.h"
#include "latserver.h"
#include "lxz_version.h"
#include "lxz_ring.h"
#include "lxz_string.h"
#include "lxz_dstring.h"
#include "lxz_atc_req.h"
#include "lxz_inner_cmd.h"
#include "lxz_ccore_cmd.h"
#include "lxz_sgcc_cmd.h"
#include "lxz_urc_table.h"
#include "lxz_spcomm.h"
#include "lxz_ftp.h"

#include "lxz_dbg_vmem.h"

sint32 g_newclient_socketid = 0xff;

typedef struct _lxzat_sgcc_socket_t
{
    uint16 ut_local_port; /* The Port of local-host */
    uint16 ut_peer_port;  /* The Port of remote-host */
    sint32 it_channel_id; /* Network-Interface ID */
    sint32 it_vsp_id;     /* Virtual-SerialPort ID */
    uint32 it_mark_time;
    uint32 it_urc_flag;
    uint32 it_rawmode_flag;
    sint32 it_socket_id;
    sint32 it_net_type;
    sint32 it_view_mode;
    sint32 it_socket_fd;
    sint32 it_socket_state;
    sint32 it_data_len;
    sint32 it_rxdata_len; /* the length of data that stored in rxbuf */
    sint32 it_rxbuf_size; /* The size of rxbuf */
    uint08 pt_ip_peer[16];/* The IP-Address of remote-host */
    uint08 pt_ip_host[16];/* The IP-Address of local-host */
    uint08 * pt_rxbuf;    /* pointer of rxbuf */
    uint08 * pt_peer_url;/* The Domain-Name of remote-host */
}lxzat_sgcc_socket_t;

typedef struct _lxzat_resp_mynetack_t
{
    sint32 txdata_sending_size;
    sint32 txdata_free_size;
}lxzat_resp_mynetack_t;

/*
 *  Description:
 *    A structure for saving parameters and result.
 *  Note: NONE
 */
typedef struct _lxzat_resp_mynetwget_t
{
    sint32 it_fd_socket;
    uint16 it_rw_status;
    uint16 it_url_port;
    uint08 pt_url_host[LXZAT_URL_LENGTH_MAX];
    uint08 pt_url_file[LXZAT_URL_LENGTH_MAX];
} lxzat_resp_mynetwget_t;

static lxzat_sgcc_socket_t gs_sgcc_socket_pool[LXZAT_SGCC_NUM_MAX] = {0};

/*
 *  Description:
 *    A structure for saving parameters and result.
 *  Note: NONE
 */
typedef struct _lxzat_resp_myccid_t
{
    uint08 u_iccid_buf[LXZAT_SGCC_ICCID_LEN_MAX];
} lxzat_resp_myccid_t;

/*
 *  Description:
 *    A structure for saving parameters and result.
 *  Note: NONE
 */
typedef struct _lxzat_resp_mysysinfo_t
{
    sint32 it_mn_mode;     /* mobile network mode */
    sint32 it_mn_operator; /* mobile network operator */
} lxzat_resp_mysysinfo_t;

typedef struct _lxzat_mysysinfo_oper_t
{
    sint32 it_mn_mcc;
    sint32 it_mn_mnc;
    sint32 it_mysysinfo_oper;
}lxzat_mysysinfo_oper_t;

typedef struct _lxzat_mysysinfo_rat_t
{
    sint32 it_cops_rat;
    sint32 it_mysysinfo_rat;
}lxzat_mysysinfo_rat_t;

static lxzat_mysysinfo_oper_t gs_mysysinfo_oper_table[] =
{
    {460, 0, 1  /* China Mobile,LTE/GSM */},
    {460, 1, 2  /* China Unicom,LTE/GSM */},
    {460, 2, 1  /* China Mobile,TD-S */},
    {460, 3, 3  /* China Tsgccom,CDMA/EVDO */},
    {460, 4, 99 /* AMSS */},
    {460, 5, 3  /* China Tsgccom */},
    {460, 6, 2  /* China Unicom,GSM/UMTS */},
    {460, 7, 1  /* China Mobile,TD-S */},
    {460, 11, 3 /* China Tsgccom,FDD-LTE */},
    {460, 20, 99/* China TieTong,GMR-R */},
    {0, 0, 0}
};

static lxzat_mysysinfo_rat_t gs_mysysinfo_rat_table[] =
{
    {0, 2/* 2G */},
    {2, 3/* 3G */},
    {7, 4/* 4G */},
    {0, 0}
};

typedef struct _lxzat_sgcc_rawmode_t
{
    sint32    it_rawmode_timeout;
    sint32    it_rawmode_nbbytes;
}lxzat_sgcc_rawmode_t;

static lxzat_sgcc_rawmode_t gs_sgcc_rawmode_table[LXZAT_CHANNEL_ID_MAX+1]=
{
    {100/*ms*/, 1024/*octets*/},
    {100/*ms*/, 1024/*octets*/},
    {100/*ms*/, 1024/*octets*/},
    {100/*ms*/, 1024/*octets*/},
    {100/*ms*/, 1024/*octets*/},
    {100/*ms*/, 1024/*octets*/}
};

static sint32 gs_sgcc_baundrate_table[LXZAT_SGCC_BAUNDTATE_NUM] = {9600,19200,38400,57600,115200};

/* Details: 0:Auto,No lock;1:GSM_EGSM_900;2:GSM_DCS_1800. */
static sint32 gs_lock_gsmband = 0;

/* Details: 0:Auto,No lock;[1-3]:The number of BCCH has been locked. */
static sint32 gs_lock_gsmbcch = 0;

typedef struct _lxzat_mybcch_t
{
    uint16    ut_bcch_id;
    uint16    ut_mcc_id;
    uint16    ut_mnc_id;
    uint16    ut_lac_id;
    uint16    ut_cell_id;
}lxzat_mybcch_t;

static lxzat_mybcch_t gs_list_gsmbcch_table[]=
{
    {115/*BCCH*/, 460/*MCC*/, 0x03/*MNC*/, 0x2540/*LAC*/, 0x79BB/*CellID*/},
    {113/*BCCH*/, 460/*MCC*/, 0x03/*MNC*/, 0x2540/*LAC*/, 0x79BC/*CellID*/},
    {111/*BCCH*/, 460/*MCC*/, 0x03/*MNC*/, 0x2540/*LAC*/, 0x79BA/*CellID*/}
};

static lxzat_mybcch_t gs_lock_gsmbcch_table[3]=
{
    {0/*BCCH*/, 0/*MCC*/, 0/*MNC*/, 0/*LAC*/, 0/*CellID*/},
    {0/*BCCH*/, 0/*MCC*/, 0/*MNC*/, 0/*LAC*/, 0/*CellID*/},
    {0/*BCCH*/, 0/*MCC*/, 0/*MNC*/, 0/*LAC*/, 0/*CellID*/}
};

static lxz_easyftp_t * gsp_eftp_context = NULL;

static void * gsp_ppplogger_context = NULL;

/*
 *  Description:
 *    A structure for saving parameters and result.
 *  Note: NONE
 */
typedef struct _lxzat_resp_mydnsquery_t
{
    sint32 i_got_flag;
    sint32 i_epdp_id;
    uint08 u_ipaddr_buf[LXZAT_IPBUF_SIZE_MAX];
} lxzat_resp_mydnsquery_t;

/*
 *  Description:
 *    A structure for saving parameters and result.
 *  Note: NONE
 */
typedef struct _lxzat_resp_mytype_t
{
    uint08 i_mode;
    uint08 i_network_type;
    uint08 i_extended_feature;
} lxzat_resp_mytype_t;

/* URC: 0:off, 1:on */
static sint32 gs_myurcsysinfo_urctype = 0;

static sint32 lxzat_dollar_mypoweroff_init(void * pctxt);
static sint32 lxzat_dollar_mypoweroff_req(void * pctxt);
static sint32 lxzat_dollar_mypoweroff_resp(void * pctxt);
static sint32 lxzat_dollar_mypoweroff_reset(void * pctxt);

static sint32 lxzat_dollar_mysocketled_init(void * pctxt);
static sint32 lxzat_dollar_mysocketled_req(void * pctxt);
static sint32 lxzat_dollar_mysocketled_resp(void * pctxt);
static sint32 lxzat_dollar_mysocketled_reset(void * pctxt);

static sint32 lxzat_dollar_mygmr_init(void * pctxt);
static sint32 lxzat_dollar_mygmr_req(void * pctxt);
static sint32 lxzat_dollar_mygmr_resp(void * pctxt);
static sint32 lxzat_dollar_mygmr_reset(void * pctxt);

static sint32 lxzat_dollar_myccid_init(void * pctxt);
static sint32 lxzat_dollar_myccid_req(void * pctxt);
static sint32 lxzat_dollar_myccid_resp(void * pctxt);
static sint32 lxzat_dollar_myccid_reset(void * pctxt);

static sint32 lxzat_dollar_myneturc_init(void * pctxt);
static sint32 lxzat_dollar_myneturc_req(void * pctxt);
static sint32 lxzat_dollar_myneturc_resp(void * pctxt);
static sint32 lxzat_dollar_myneturc_reset(void * pctxt);

static sint32 lxzat_dollar_mytype_init(void * pctxt);
static sint32 lxzat_dollar_mytype_req(void * pctxt);
static sint32 lxzat_dollar_mytype_resp(void * pctxt);
static sint32 lxzat_dollar_mytype_reset(void * pctxt);

static sint32 lxzat_dollar_mynetcon_init(void * pctxt);
static sint32 lxzat_dollar_mynetcon_req(void * pctxt);
static sint32 lxzat_dollar_mynetcon_resp(void * pctxt);
static sint32 lxzat_dollar_mynetcon_reset(void * pctxt);

static sint32 lxzat_dollar_mynetact_init(void * pctxt);
static sint32 lxzat_dollar_mynetact_req(void * pctxt);
static sint32 lxzat_dollar_mynetact_resp(void * pctxt);
static sint32 lxzat_dollar_mynetact_reset(void * pctxt);

static sint32 lxzat_dollar_myipfilter_init(void * pctxt);
static sint32 lxzat_dollar_myipfilter_req(void * pctxt);
static sint32 lxzat_dollar_myipfilter_resp(void * pctxt);
static sint32 lxzat_dollar_myipfilter_reset(void * pctxt);

static sint32 lxzat_dollar_mynetsrv_init(void * pctxt);
static sint32 lxzat_dollar_mynetsrv_req(void * pctxt);
static sint32 lxzat_dollar_mynetsrv_resp(void * pctxt);
static sint32 lxzat_dollar_mynetsrv_reset(void * pctxt);

static sint32 lxzat_dollar_mynetopen_init(void * pctxt);
static sint32 lxzat_dollar_mynetopen_req(void * pctxt);
static sint32 lxzat_dollar_mynetopen_resp(void * pctxt);
static sint32 lxzat_dollar_mynetopen_reset(void * pctxt);

static sint32 lxzat_dollar_mynetread_init(void * pctxt);
static sint32 lxzat_dollar_mynetread_req(void * pctxt);
static sint32 lxzat_dollar_mynetread_resp(void * pctxt);
static sint32 lxzat_dollar_mynetread_reset(void * pctxt);

static sint32 lxzat_dollar_mynetwrite_init(void * pctxt);
static sint32 lxzat_dollar_mynetwrite_req(void * pctxt);
static sint32 lxzat_dollar_mynetwrite_resp(void * pctxt);
static sint32 lxzat_dollar_mynetwrite_reset(void * pctxt);

static sint32 lxzat_dollar_mynetclose_init(void * pctxt);
static sint32 lxzat_dollar_mynetclose_req(void * pctxt);
static sint32 lxzat_dollar_mynetclose_resp(void * pctxt);
static sint32 lxzat_dollar_mynetclose_reset(void * pctxt);

static sint32 lxzat_dollar_mynetack_init(void * pctxt);
static sint32 lxzat_dollar_mynetack_req(void * pctxt);
static sint32 lxzat_dollar_mynetack_resp(void * pctxt);
static sint32 lxzat_dollar_mynetack_reset(void * pctxt);

static sint32 lxzat_dollar_mynetaccept_init(void * pctxt);
static sint32 lxzat_dollar_mynetaccept_req(void * pctxt);
static sint32 lxzat_dollar_mynetaccept_resp(void * pctxt);
static sint32 lxzat_dollar_mynetaccept_reset(void * pctxt);

static sint32 lxzat_dollar_mynetcreate_init(void * pctxt);
static sint32 lxzat_dollar_mynetcreate_req(void * pctxt);
static sint32 lxzat_dollar_mynetcreate_resp(void * pctxt);
static sint32 lxzat_dollar_mynetcreate_reset(void * pctxt);

static sint32 lxzat_dollar_myftpopen_init(void * pctxt);
static sint32 lxzat_dollar_myftpopen_req(void * pctxt);
static sint32 lxzat_dollar_myftpopen_resp(void * pctxt);
static sint32 lxzat_dollar_myftpopen_reset(void * pctxt);

static sint32 lxzat_dollar_myftpclose_init(void * pctxt);
static sint32 lxzat_dollar_myftpclose_req(void * pctxt);
static sint32 lxzat_dollar_myftpclose_resp(void * pctxt);
static sint32 lxzat_dollar_myftpclose_reset(void * pctxt);

static sint32 lxzat_dollar_myftpsize_init(void * pctxt);
static sint32 lxzat_dollar_myftpsize_req(void * pctxt);
static sint32 lxzat_dollar_myftpsize_resp(void * pctxt);
static sint32 lxzat_dollar_myftpsize_reset(void * pctxt);

static sint32 lxzat_dollar_myftpget_init(void * pctxt);
static sint32 lxzat_dollar_myftpget_req(void * pctxt);
static sint32 lxzat_dollar_myftpget_resp(void * pctxt);
static sint32 lxzat_dollar_myftpget_reset(void * pctxt);

static sint32 lxzat_dollar_myftpput_init(void * pctxt);
static sint32 lxzat_dollar_myftpput_req(void * pctxt);
static sint32 lxzat_dollar_myftpput_resp(void * pctxt);
static sint32 lxzat_dollar_myftpput_reset(void * pctxt);

static sint32 lxzat_dollar_mybcch_init(void * pctxt);
static sint32 lxzat_dollar_mybcch_req(void * pctxt);
static sint32 lxzat_dollar_mybcch_resp(void * pctxt);
static sint32 lxzat_dollar_mybcch_reset(void * pctxt);

static sint32 lxzat_dollar_myband_init(void * pctxt);
static sint32 lxzat_dollar_myband_req(void * pctxt);
static sint32 lxzat_dollar_myband_resp(void * pctxt);
static sint32 lxzat_dollar_myband_reset(void * pctxt);

static sint32 lxzat_dollar_mygpspos_init(void * pctxt);
static sint32 lxzat_dollar_mygpspos_req(void * pctxt);
static sint32 lxzat_dollar_mygpspos_resp(void * pctxt);
static sint32 lxzat_dollar_mygpspos_reset(void * pctxt);

static sint32 lxzat_dollar_mysysinfo_init(void * pctxt);
static sint32 lxzat_dollar_mysysinfo_req(void * pctxt);
static sint32 lxzat_dollar_mysysinfo_resp(void * pctxt);
static sint32 lxzat_dollar_mysysinfo_reset(void * pctxt);

static sint32 lxzat_dollar_mysysmode_init(void * pctxt);
static sint32 lxzat_dollar_mysysmode_req(void * pctxt);
static sint32 lxzat_dollar_mysysmode_resp(void * pctxt);
static sint32 lxzat_dollar_mysysmode_reset(void * pctxt);

static sint32 lxzat_dollar_mymodem_init(void * pctxt);
static sint32 lxzat_dollar_mymodem_req(void * pctxt);
static sint32 lxzat_dollar_mymodem_resp(void * pctxt);
static sint32 lxzat_dollar_mymodem_reset(void * pctxt);

static sint32 lxzat_dollar_mynetinfo_init(void * pctxt);
static sint32 lxzat_dollar_mynetinfo_req(void * pctxt);
static sint32 lxzat_dollar_mynetinfo_resp(void * pctxt);
static sint32 lxzat_dollar_mynetinfo_reset(void * pctxt);

static sint32 lxzat_dollar_mynetorder_init(void * pctxt);
static sint32 lxzat_dollar_mynetorder_req(void * pctxt);
static sint32 lxzat_dollar_mynetorder_resp(void * pctxt);
static sint32 lxzat_dollar_mynetorder_reset(void * pctxt);

static sint32 lxzat_dollar_mynetput_init(void * pctxt);
static sint32 lxzat_dollar_mynetput_req(void * pctxt);
static sint32 lxzat_dollar_mynetput_resp(void * pctxt);
static sint32 lxzat_dollar_mynetput_reset(void * pctxt);

static sint32 lxzat_dollar_mynetget_init(void * pctxt);
static sint32 lxzat_dollar_mynetget_req(void * pctxt);
static sint32 lxzat_dollar_mynetget_resp(void * pctxt);
static sint32 lxzat_dollar_mynetget_reset(void * pctxt);

static sint32 lxzat_dollar_mytimeset_init(void * pctxt);
static sint32 lxzat_dollar_mytimeset_req(void * pctxt);
static sint32 lxzat_dollar_mytimeset_resp(void * pctxt);
static sint32 lxzat_dollar_mytimeset_reset(void * pctxt);

static sint32 lxzat_dollar_mytimeget_init(void * pctxt);
static sint32 lxzat_dollar_mytimeget_req(void * pctxt);
static sint32 lxzat_dollar_mytimeget_resp(void * pctxt);
static sint32 lxzat_dollar_mytimeget_reset(void * pctxt);

static sint32 lxzat_dollar_mytimentp_init(void * pctxt);
static sint32 lxzat_dollar_mytimentp_req(void * pctxt);
static sint32 lxzat_dollar_mytimentp_resp(void * pctxt);
static sint32 lxzat_dollar_mytimentp_reset(void * pctxt);

static sint32 lxzat_dollar_mydnsquery_init(void * pctxt);
static sint32 lxzat_dollar_mydnsquery_req(void * pctxt);
static sint32 lxzat_dollar_mydnsquery_resp(void * pctxt);
static sint32 lxzat_dollar_mydnsquery_reset(void * pctxt);

static sint32 lxzat_dollar_myurcsysinfo_init(void * pctxt);
static sint32 lxzat_dollar_myurcsysinfo_req(void * pctxt);
static sint32 lxzat_dollar_myurcsysinfo_resp(void * pctxt);
static sint32 lxzat_dollar_myurcsysinfo_reset(void * pctxt);

static sint32 lxzat_dollar_myipr_init(void * pctxt);
static sint32 lxzat_dollar_myipr_req(void * pctxt);
static sint32 lxzat_dollar_myipr_resp(void * pctxt);
static sint32 lxzat_dollar_myipr_reset(void * pctxt);

static sint32 lxzat_dollar_mynetwget_init(void * pctxt);
static sint32 lxzat_dollar_mynetwget_req(void * pctxt);
static sint32 lxzat_dollar_mynetwget_resp(void * pctxt);
static sint32 lxzat_dollar_mynetwget_reset(void * pctxt);

static sint32 lxzat_callback_tcpclient_f_exec(sint32 p1, sint32 p2);
static sint32 lxzat_callback_tcpclient_f_exit(sint32 p1, sint32 p2);

static sint32 lxzat_callback_udpclient_f_exec(sint32 p1, sint32 p2);
static sint32 lxzat_callback_udpclient_f_exit(sint32 p1, sint32 p2);

static sint32 lxzat_callback_rawmode_tcpclient_f_exec(sint32 p1, sint32 p2);
static sint32 lxzat_callback_rawmode_tcpclient_f_exit(sint32 p1, sint32 p2);

static sint32 lxzat_callback_rawmode_udpclient_f_exec(sint32 p1, sint32 p2);
static sint32 lxzat_callback_rawmode_udpclient_f_exit(sint32 p1, sint32 p2);

static sint32 lxzat_callback_tcpserver_f_exec(sint32 p1, sint32 p2);
static sint32 lxzat_callback_tcpserver_f_exit(sint32 p1, sint32 p2);

static sint32 lxzat_callback_myurcclose_f_exec(sint32 p1, sint32 p2);
static sint32 lxzat_callback_myurcclose_f_exit(sint32 p1, sint32 p2);

static sint32 lxzat_callback_ftpcmd_f_exec(sint32 p1, sint32 p2);
static sint32 lxzat_callback_ftpcmd_f_exit(sint32 p1, sint32 p2);
static sint32 lxzat_callback_ftpdata_f_exec(sint32 p1, sint32 p2);
static sint32 lxzat_callback_ftpdata_f_exit(sint32 p1, sint32 p2);
static sint32 lxzat_callback_myurcftp_f_exec(sint32 p1, sint32 p2);
static sint32 lxzat_callback_myurcftp_f_exit(sint32 p1, sint32 p2);

static sint32 lxzat_callback_myurcact_f_exec(sint32 p1, sint32 p2);
static sint32 lxzat_callback_myurcact_f_exit(sint32 p1, sint32 p2);
static sint32 lxzat_callback_myurcdeact_f_exec(sint32 p1, sint32 p2);
static sint32 lxzat_callback_myurcdeact_f_exit(sint32 p1, sint32 p2);

static sint32 lxzat_task_rawmode_udpclient_newtask(sint32 i_id_socket);
static sint32 lxzat_task_rawmode_tcpclient_newtask(sint32 i_id_socket);
static sint32 lxzat_task_udpclient_newtask(sint32 i_id_socket);
static sint32 lxzat_task_tcpclient_newtask(sint32 i_id_socket);
static sint32 lxzat_task_tcpserver_newtask(sint32 i_id_socket);
static sint32 lxzat_task_ftpcmd_newtask(sint32 i_vsp_id);
static sint32 lxzat_task_ftpdata_newtask(sint32 i_vsp_id);
static sint32 lxzat_task_myurcact_newtask(sint32 i_id_vspctxt, sint32 i_id_pdpctxt);
static sint32 lxzat_task_myurcdeact_newtask(sint32 i_id_vspctxt, sint32 i_id_pdpctxt);
static sint32 lxzat_task_myurcclose_newtask(sint32 i_id_vspctxt, sint32 i_id_pdpctxt);
static sint32 lxzat_task_myurcftp_newtask(sint32 i_id_vspctxt, sint32 i_id_pdpctxt);

static sint32 lxzat_sgcc_tcpserver_f_create(void * pctxt,sint32 sock_id);
static sint32 lxzat_sgcc_tcpserver_f_accept(sint32 socket_id,sint32 accept_action,sint32 connect_mode);
static sint32 lxzat_sgcc_socket_f_close(sint32 i_id_socket);

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mypoweroff =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYPOWEROFF",
    lxzat_dollar_mypoweroff_init,
    lxzat_dollar_mypoweroff_req,
    lxzat_dollar_mypoweroff_resp,
    lxzat_dollar_mypoweroff_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mysocketled =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYSOCKETLED",
    lxzat_dollar_mysocketled_init,
    lxzat_dollar_mysocketled_req,
    lxzat_dollar_mysocketled_resp,
    lxzat_dollar_mysocketled_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mygmr =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYGMR",
    lxzat_dollar_mygmr_init,
    lxzat_dollar_mygmr_req,
    lxzat_dollar_mygmr_resp,
    lxzat_dollar_mygmr_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_myccid =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYCCID",
    lxzat_dollar_myccid_init,
    lxzat_dollar_myccid_req,
    lxzat_dollar_myccid_resp,
    lxzat_dollar_myccid_reset
};


enum AT_MYNETURC_TYPE_ENUM
{
    AT_MYNETURC_TYPE_OFF = 0,
    AT_MYNETURC_TYPE_ON  = 1,

    AT_MYNETURC_TYPE_BUTT
};
typedef sint32 AT_MYNETURC_TYPE_ENUM_SINT32;


AT_MYNETURC_TYPE_ENUM_SINT32  gMyNetUrcType = AT_MYNETURC_TYPE_ON;

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_myneturc =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYNETURC",
    lxzat_dollar_myneturc_init,
    lxzat_dollar_myneturc_req,
    lxzat_dollar_myneturc_resp,
    lxzat_dollar_myneturc_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mytype =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYTYPE",
    lxzat_dollar_mytype_init,
    lxzat_dollar_mytype_req,
    lxzat_dollar_mytype_resp,
    lxzat_dollar_mytype_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mynetcon =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYNETCON",
    lxzat_dollar_mynetcon_init,
    lxzat_dollar_mynetcon_req,
    lxzat_dollar_mynetcon_resp,
    lxzat_dollar_mynetcon_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mynetact =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYNETACT",
    lxzat_dollar_mynetact_init,
    lxzat_dollar_mynetact_req,
    lxzat_dollar_mynetact_resp,
    lxzat_dollar_mynetact_reset
};

#define AT_MyIpFilter_MAX_NUM 5
#define AT_MyFtp_MAX_NUM     8
#define AT_MyFtp_Get_NUM        4
#define AT_FTP_PARM_NUM       1
#define AT_ASCII_MAX_NUM            255
#define AT_UpGrade_MAX_NUM     7


enum AT_MYFILTER_OPYPE_ENUM
{
    AT_MYFILTER_OPYPE_DEL                  = 0,
    AT_MYFILTER_OPYPE_ADD_EDIT                  = 1,
    AT_MYFILTER_OPYPE_DEL_ALL                  = 2,

    AT_MYFILTER_OPYPE_BUTT
};

typedef struct _lxzat_myipfilter_t
{
    uint08        ip_address[16];
    uint08        net_mask[16];
    uint32        act_flag;
}lxzat_myipfilter_t;

static lxzat_myipfilter_t gastMyIpFilterInfo[AT_MyIpFilter_MAX_NUM]={0};


/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_myipfilter =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYIPFILTER",
    lxzat_dollar_myipfilter_init,
    lxzat_dollar_myipfilter_req,
    lxzat_dollar_myipfilter_resp,
    lxzat_dollar_myipfilter_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mynetsrv =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYNETSRV",
    lxzat_dollar_mynetsrv_init,
    lxzat_dollar_mynetsrv_req,
    lxzat_dollar_mynetsrv_resp,
    lxzat_dollar_mynetsrv_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mynetopen =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYNETOPEN",
    lxzat_dollar_mynetopen_init,
    lxzat_dollar_mynetopen_req,
    lxzat_dollar_mynetopen_resp,
    lxzat_dollar_mynetopen_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mynetread =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYNETREAD",
    lxzat_dollar_mynetread_init,
    lxzat_dollar_mynetread_req,
    lxzat_dollar_mynetread_resp,
    lxzat_dollar_mynetread_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mynetwrite =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYNETWRITE",
    lxzat_dollar_mynetwrite_init,
    lxzat_dollar_mynetwrite_req,
    lxzat_dollar_mynetwrite_resp,
    lxzat_dollar_mynetwrite_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mynetclose =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYNETCLOSE",
    lxzat_dollar_mynetclose_init,
    lxzat_dollar_mynetclose_req,
    lxzat_dollar_mynetclose_resp,
    lxzat_dollar_mynetclose_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mynetack =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYNETACK",
    lxzat_dollar_mynetack_init,
    lxzat_dollar_mynetack_req,
    lxzat_dollar_mynetack_resp,
    lxzat_dollar_mynetack_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mynetaccept =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYNETACCEPT",
    lxzat_dollar_mynetaccept_init,
    lxzat_dollar_mynetaccept_req,
    lxzat_dollar_mynetaccept_resp,
    lxzat_dollar_mynetaccept_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mynetcreate =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYNETCREATE",
    lxzat_dollar_mynetcreate_init,
    lxzat_dollar_mynetcreate_req,
    lxzat_dollar_mynetcreate_resp,
    lxzat_dollar_mynetcreate_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_myftpopen =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYFTPOPEN",
    lxzat_dollar_myftpopen_init,
    lxzat_dollar_myftpopen_req,
    lxzat_dollar_myftpopen_resp,
    lxzat_dollar_myftpopen_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_myftpclose =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYFTPCLOSE",
    lxzat_dollar_myftpclose_init,
    lxzat_dollar_myftpclose_req,
    lxzat_dollar_myftpclose_resp,
    lxzat_dollar_myftpclose_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_myftpsize =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYFTPSIZE",
    lxzat_dollar_myftpsize_init,
    lxzat_dollar_myftpsize_req,
    lxzat_dollar_myftpsize_resp,
    lxzat_dollar_myftpsize_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_myftpget =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYFTPGET",
    lxzat_dollar_myftpget_init,
    lxzat_dollar_myftpget_req,
    lxzat_dollar_myftpget_resp,
    lxzat_dollar_myftpget_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_myftpput =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYFTPPUT",
    lxzat_dollar_myftpput_init,
    lxzat_dollar_myftpput_req,
    lxzat_dollar_myftpput_resp,
    lxzat_dollar_myftpput_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mybcch =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYBCCH",
    lxzat_dollar_mybcch_init,
    lxzat_dollar_mybcch_req,
    lxzat_dollar_mybcch_resp,
    lxzat_dollar_mybcch_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_myband =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYBAND",
    lxzat_dollar_myband_init,
    lxzat_dollar_myband_req,
    lxzat_dollar_myband_resp,
    lxzat_dollar_myband_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mygpspos =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_EXTEND,
    "$MYGPSPOS",
    lxzat_dollar_mygpspos_init,
    lxzat_dollar_mygpspos_req,
    lxzat_dollar_mygpspos_resp,
    lxzat_dollar_mygpspos_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mysysinfo =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYSYSINFO",
    lxzat_dollar_mysysinfo_init,
    lxzat_dollar_mysysinfo_req,
    lxzat_dollar_mysysinfo_resp,
    lxzat_dollar_mysysinfo_reset
};


const lxzat_info_t lai_dollar_mysysmode =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYSYSMODE",
    lxzat_dollar_mysysmode_init,
    lxzat_dollar_mysysmode_req,
    lxzat_dollar_mysysmode_resp,
    lxzat_dollar_mysysmode_reset
};

const lxzat_info_t lai_dollar_mymodem =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYMODEM",
    lxzat_dollar_mymodem_init,
    lxzat_dollar_mymodem_req,
    lxzat_dollar_mymodem_resp,
    lxzat_dollar_mymodem_reset
};

const lxzat_info_t lai_dollar_mynetinfo =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYNETINFO",
    lxzat_dollar_mynetinfo_init,
    lxzat_dollar_mynetinfo_req,
    lxzat_dollar_mynetinfo_resp,
    lxzat_dollar_mynetinfo_reset
};

const lxzat_info_t lai_dollar_mynetorder =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYNETORDER",
    lxzat_dollar_mynetorder_init,
    lxzat_dollar_mynetorder_req,
    lxzat_dollar_mynetorder_resp,
    lxzat_dollar_mynetorder_reset
};

const lxzat_info_t lai_dollar_mynetput =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYNETPUT",
    lxzat_dollar_mynetput_init,
    lxzat_dollar_mynetput_req,
    lxzat_dollar_mynetput_resp,
    lxzat_dollar_mynetput_reset
};

const lxzat_info_t lai_dollar_mynetget =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYNETGET",
    lxzat_dollar_mynetget_init,
    lxzat_dollar_mynetget_req,
    lxzat_dollar_mynetget_resp,
    lxzat_dollar_mynetget_reset
};

const lxzat_info_t lai_dollar_mytimeset =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYTIMESET",
    lxzat_dollar_mytimeset_init,
    lxzat_dollar_mytimeset_req,
    lxzat_dollar_mytimeset_resp,
    lxzat_dollar_mytimeset_reset
};

const lxzat_info_t lai_dollar_mytimeget =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYTIMEGET",
    lxzat_dollar_mytimeget_init,
    lxzat_dollar_mytimeget_req,
    lxzat_dollar_mytimeget_resp,
    lxzat_dollar_mytimeget_reset
};

const lxzat_info_t lai_dollar_mytimentp =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYTIMENTP",
    lxzat_dollar_mytimentp_init,
    lxzat_dollar_mytimentp_req,
    lxzat_dollar_mytimentp_resp,
    lxzat_dollar_mytimentp_reset
};

const lxzat_info_t lai_dollar_mydnsquery =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYDNSQUERY",
    lxzat_dollar_mydnsquery_init,
    lxzat_dollar_mydnsquery_req,
    lxzat_dollar_mydnsquery_resp,
    lxzat_dollar_mydnsquery_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_myurcsysinfo =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYURCSYSINFO",
    lxzat_dollar_myurcsysinfo_init,
    lxzat_dollar_myurcsysinfo_req,
    lxzat_dollar_myurcsysinfo_resp,
    lxzat_dollar_myurcsysinfo_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_myipr =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYIPR",
    lxzat_dollar_myipr_init,
    lxzat_dollar_myipr_req,
    lxzat_dollar_myipr_resp,
    lxzat_dollar_myipr_reset
};

/*
 *  Description:
 *    A caplets for hiding concrete implementation.
 *  Note:
 *    Please do not change any part of current piece when you unsure.
 */
const lxzat_info_t lai_dollar_mynetwget =
{
    LXZAT_TYPE_RANGE_LOCAL|LXZAT_TYPE_STRING_BASIC,
    "$MYNETWGET",
    lxzat_dollar_mynetwget_init,
    lxzat_dollar_mynetwget_req,
    lxzat_dollar_mynetwget_resp,
    lxzat_dollar_mynetwget_reset
};

static sint32 lxzat_sgcc_ifconfig_f_get(sint32 i_channel_id, uint08 * p_ipaddr_buf)
{
    sint32 i_flag_isactive = LXZAT_FALSE;
    sint32 i_cur_pdpstatus = 0;

    if ((i_channel_id < LXZAT_CHANNEL_ID_MIN) || (i_channel_id >LXZAT_CHANNEL_ID_MAX))
    {
        return LXZAT_FALSE;
    }

    lxzat_pdpinfo_f_getstatus(i_channel_id + 1, &i_cur_pdpstatus);
    if (E_PDP_STATUS_ACTIVATED == i_cur_pdpstatus)
    {
        i_flag_isactive = LXZAT_TRUE;
        lxzat_pdpinfo_f_getipaddress(i_channel_id + 1, p_ipaddr_buf);
    }

    OS_DBG_LOG(("lxzat:lxzat_sgcc_ifconfig_f_get:i_flag_isactive=%d\r\n", i_flag_isactive));
    OS_DBG_LOG(("lxzat:lxzat_sgcc_ifconfig_f_get:i_channel_id=%d\r\n", i_channel_id));
    OS_DBG_LOG(("lxzat:lxzat_sgcc_ifconfig_f_get:p_ipaddr_buf=%s\r\n", p_ipaddr_buf));

    return i_flag_isactive;
}

sint32 lxzurc_mysysinfo_rat_f_get(sint32 i_index_id)
{
    sint32 i_ai_num = 0;
    
    i_ai_num = sizeof(gs_mysysinfo_rat_table)/sizeof(gs_mysysinfo_rat_table[0]);
    if (i_index_id < i_ai_num)
    {
        return gs_mysysinfo_rat_table[i_index_id].it_mysysinfo_rat;
    }
    
    return 0;
}

sint32 lxzurc_mysysinfo_oper_f_get(sint32 i_index_id)
{
    sint32 i_ai_num = 0;
    
    i_ai_num = sizeof(gs_mysysinfo_oper_table)/sizeof(gs_mysysinfo_oper_table[0]);
    if (i_index_id < i_ai_num)
    {
        return gs_mysysinfo_oper_table[i_index_id].it_mysysinfo_oper;
    }
    
    return 0;
}

static sint32 lxzat_sgcc_tcpserver_f_create(void * pctxt, sint32 i_id_socket)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_id_findsocket = 0;

    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;
    lxzat_sgcc_socket_t * p_sgcc_otsocket = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);


    for (i_id_findsocket=0; i_id_findsocket < LXZAT_SGCC_NUM_MAX; i_id_findsocket++)
    {
        p_sgcc_otsocket = &(gs_sgcc_socket_pool[i_id_findsocket]);
        if(i_id_findsocket == i_id_socket)
        {
            continue;
        }
        if (   (p_sgcc_otsocket->it_net_type == LXZAT_NET_TYPE_TCPS)
            && (p_sgcc_otsocket->it_socket_state != E_LESS_IDLE)
            && (p_sgcc_otsocket->it_socket_state != E_LESS_CONFIG))
        {
            if(p_sgcc_socket->pt_rxbuf != NULL)
            {
                free(p_sgcc_socket->pt_rxbuf);
                p_sgcc_socket->pt_rxbuf = NULL;
            }

            if(p_sgcc_socket->pt_peer_url != NULL)
            {
                free(p_sgcc_socket->pt_peer_url);
                p_sgcc_socket->pt_peer_url = NULL;
            }

            memset(p_sgcc_socket, 0, sizeof(lxzat_sgcc_socket_t));
            break;
        }
    }

    if (i_id_findsocket < LXZAT_SGCC_NUM_MAX)
    {
        OS_DBG_LOG(("lxzat_sgcc_tcpserver_f_create,tcp-server is already exist\r\n"));
        return E_LEC_SGCC_SOCKET_CONNECT;
    }
    else
    {
        strcpy(p_sgcc_socket->pt_ip_peer, "0.0.0.0");
        p_sgcc_socket->ut_peer_port  = 0;
    }

    p_sgcc_socket->it_socket_fd = osp_socket_f_open(2/*AF_INET*/, 1/*SOCK_STREAM*/, 0);
    if(p_sgcc_socket->it_socket_fd == 0)
    {
        OS_DBG_LOG(("lxzat_sgcc_tcpserver_f_create,tcps create socket error!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    if(osp_socket_f_bind(p_sgcc_socket->it_socket_fd, "0.0.0.0", p_sgcc_socket->ut_local_port) == 0)
    {
        OS_DBG_LOG(("lxzat_sgcc_tcpserver_f_create,tcps bind socket error!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    if(osp_socket_f_listen(p_sgcc_socket->it_socket_fd,SGCC_MAX_BACK_LOG) == 0)
    {
        OS_DBG_LOG(("lxzat_sgcc_tcpserver_f_create,tcps listen socket error!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_sgcc_socket->it_socket_state = E_LESS_ESTABLISHED;
    lxzat_task_tcpserver_newtask(i_id_socket);

    return i_err_code;
}

static sint32 lxzat_sgcc_tcpserver_f_accept(sint32 i_id_socket, sint32 accept_action,sint32 connect_mode)
{
    sint32 action = 0;
    uint16 i_accept_status = 0;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
    action = accept_action;

    if(p_sgcc_socket->it_socket_fd == 0)
    {
        return i_accept_status;
    }

    if(action)
    {
        lxzat_sgcc_socket_f_close(i_id_socket);
        return i_accept_status;
    }
    else
    {
        i_accept_status = 1;
    }
    return i_accept_status;

}


static sint32 lxzat_sgcc_socket_f_close(sint32 i_id_socket)
{
    sint32 i_op_status = 0;

	lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX)
    {
        OS_DBG_LOG(("lxzat_sgcc_socket_f_close,i_id_socket=%d\r\n",i_id_socket));
        return i_op_status;
    }

    p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
    if(p_sgcc_socket->pt_peer_url != NULL)
    {
        free(p_sgcc_socket->pt_peer_url);
        p_sgcc_socket->pt_peer_url = NULL;
    }

    if(p_sgcc_socket->pt_rxbuf != NULL)
    {
        free(p_sgcc_socket->pt_rxbuf);
        p_sgcc_socket->pt_rxbuf = NULL;
    }

    if (p_sgcc_socket->it_socket_fd > 0)
    {
        osp_socket_f_close(p_sgcc_socket->it_socket_fd);
    }

	p_cur_spcfg = lxzat_spcomm_f_get(p_sgcc_socket->it_vsp_id);
    if (p_cur_spcfg != NULL)
    {
		p_cur_datacfg = p_cur_spcfg->pt_di_cfg;
		if (p_cur_datacfg != NULL)
		{
			if (p_cur_datacfg->p_param_ctxt != NULL)
			{
				free(p_cur_datacfg->p_param_ctxt);
				p_cur_datacfg->p_param_ctxt = NULL;
			}
			free(p_cur_datacfg);
			p_cur_spcfg->pt_di_cfg = NULL;
		}
    }

    memset(p_sgcc_socket, 0, sizeof(lxzat_sgcc_socket_t));
    i_op_status = 1;

    return i_op_status;
}

/*
 *  Description:
 *    The 2nd step of "AT$MYNETWRITE".
 *  Param: p_data_buf, the pointer of data buffer;
 *  Param: i_data_len, the length of data in buffer;
 *  Param: i_end_flag, the end-flag recved or not;
 *  Param: pctxt, the descriptor of serial-port;
 *  Return: the number of bytes have been sent;
 *  Note: NONE
 */
static sint32 lxzdata_dollar_mynetwrite_tcphandler(sint32 i_end_flag, void * pctxt)
{
    sint32 i_len_handled = 0;

    sint32 i_nb_cached = 0;
    sint32 i_nb_tryget = 0;

    sint32 i_nb_read = 0;
    sint32 i_nb_write = 0;
    sint32 i_nb_tryread = 0;
    sint32 i_nb_trywrite = 0;
    uint08 * p_buf_data = NULL;

    sint32 i_id_socket = 0;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    p_cur_spcfg = (lxzat_spcfg_t *)pctxt;
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzdata_dollar_mynetwrite_tcphandler,p_cur_spcfg is NULL!\r\n"));
        return i_len_handled;
    }

    p_cur_datacfg = p_cur_spcfg->pt_di_cfg;
    if (p_cur_datacfg == NULL)
    {
        OS_DBG_LOG(("lxzdata_dollar_mynetwrite_tcphandler,p_cur_datacfg is NULL!\r\n"));
        return i_len_handled;
    }

    i_nb_tryget = p_cur_spcfg->i_jump_length;
    i_nb_cached = lxz_ring_f_getoption(p_cur_spcfg->pt_rx_ring, E_LRO_DATA_SIZE);
    if (i_nb_cached < i_nb_tryget)
    {
        OS_DBG_LOG(("lxzdata_dollar_mynetwrite_tcphandler,i_nb_cached=%d\r\n",i_nb_cached));
        return i_len_handled;
    }

    i_id_socket = *((sint32 *)(p_cur_datacfg->p_param_ctxt));
    if ((i_id_socket >= 0) && (i_id_socket < LXZAT_SGCC_NUM_MAX))
    {
        i_nb_tryread = i_nb_tryget;
        p_buf_data = (uint08 *)malloc(i_nb_tryread);
        if (p_buf_data == NULL)
        {
            OS_DBG_LOG(("lxzdata_dollar_mynetwrite_tcphandler,p_buf_data malloc error!\r\n"));
            return i_len_handled;
        }

        i_nb_read = lxz_ring_f_read(p_cur_spcfg->pt_rx_ring, p_buf_data, i_nb_tryread);
        if (i_nb_read != i_nb_tryread)
        {
            OS_DBG_LOG(("lxzdata_dollar_mynetwrite_tcphandler,i_nb_read=%d\r\n",i_nb_read));
            free(p_buf_data);
            return i_len_handled;
        }
    
        p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
        if(p_sgcc_socket->it_view_mode == LXZAT_VIEW_MODE_TXT)
        {
            i_nb_trywrite = (i_nb_read >> 1);
            if(!lxz_string_f_hex2bin(p_buf_data, i_nb_read, p_buf_data))
            {
                OS_DBG_LOG(("lxzdata_dollar_mynetwrite_tcphandler,lxz_string_f_hex2bin error!\r\n"));
                free(p_buf_data);
                return i_len_handled;
            }
        }
        else
        {
            i_nb_trywrite = i_nb_read;
        }

        i_nb_write = osp_socket_f_write(p_sgcc_socket->it_socket_fd, p_buf_data, i_nb_trywrite);
        p_sgcc_socket->it_socket_state = E_LESS_ESTABLISHED;
        i_len_handled = i_nb_write;

        free(p_buf_data);
    }

    if (p_cur_datacfg->p_param_ctxt != NULL)
    {
        free(p_cur_datacfg->p_param_ctxt);
        p_cur_datacfg->p_param_ctxt = NULL;
    }
    free(p_cur_datacfg);
    p_cur_spcfg->pt_di_cfg = NULL;

    lxzat_rsp_f_printf(p_cur_spcfg->i_vsp_id, LXZAT_RSP_MODE_P1N1, "OK");

    lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
    lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
                        E_LSMX_ATC, LXZAT_END_CHAR_CR, LXZAT_END_CHAR_LF);

    i_len_handled = i_nb_read;
    return i_len_handled;
}

/*
 *  Description:
 *    The 2nd step of "AT$MYNETWRITE".
 *  Param: p_data_buf, the pointer of data buffer;
 *  Param: i_data_len, the length of data in buffer;
 *  Param: i_end_flag, the end-flag recved or not;
 *  Param: pctxt, the descriptor of serial-port;
 *  Return: the number of bytes have been sent;
 *  Note: NONE
 */
static sint32 lxzdata_dollar_mynetwrite_udphandler(sint32 i_end_flag, void * pctxt)
{
    sint32 i_len_handled = 0;

    sint32 i_nb_cached = 0;
    sint32 i_nb_tryget = 0;

    sint32 i_nb_read = 0;
    sint32 i_nb_write = 0;
    sint32 i_nb_tryread = 0;
    sint32 i_nb_trywrite = 0;

    sint32 i_buf_size = 0;
    uint08 * p_buf_data = NULL;

    sint32 i_id_socket = 0;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    p_cur_spcfg = (lxzat_spcfg_t *)pctxt;
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzdata_dollar_mynetwrite_udphandler,p_cur_spcfg is NULL!\r\n"));
        return i_len_handled;
    }

    p_cur_datacfg = p_cur_spcfg->pt_di_cfg;
    if (p_cur_datacfg == NULL)
    {
        OS_DBG_LOG(("lxzdata_dollar_mynetwrite_udphandler,p_cur_datacfg is NULL!\r\n"));
        return i_len_handled;
    }

    i_nb_tryget = p_cur_spcfg->i_jump_length;
    i_nb_cached = lxz_ring_f_getoption(p_cur_spcfg->pt_rx_ring, E_LRO_DATA_SIZE);
    if (i_nb_cached < i_nb_tryget)
    {
        OS_DBG_LOG(("lxzdata_dollar_mynetwrite_udphandler,i_nb_cached:%d,i_nb_tryget:%d\r\n",i_nb_cached,i_nb_tryget));
        return i_len_handled;
    }

    i_buf_size = i_nb_tryget;
    if (i_buf_size == 0)
    {
        OS_DBG_LOG(("lxzdata_dollar_mynetwrite_udphandler,i_nb_tryget:%d\r\n",i_nb_tryget));
        return i_len_handled;
    }

    p_buf_data = (uint08 *)malloc(i_buf_size);
    if (p_buf_data == NULL)
    {
        OS_DBG_LOG(("lxzdata_dollar_mynetwrite_udphandler,p_buf_data malloc error!\r\n"));
        return i_len_handled;
    }

    i_nb_read = lxz_ring_f_read(p_cur_spcfg->pt_rx_ring, p_buf_data, i_buf_size);
    if (i_nb_tryget != i_nb_read)
    {
        OS_DBG_LOG(("lxzdata_dollar_mynetwrite_udphandler,lxz_ring_f_read,i_nb_read:%d\r\n",i_nb_read));
        free(p_buf_data);
        return i_len_handled;
    }

    i_id_socket = *((sint32 *)(p_cur_datacfg->p_param_ctxt));
    if ((i_id_socket >= 0) && (i_id_socket < LXZAT_SGCC_NUM_MAX))
    {
        p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
        if(p_sgcc_socket->it_view_mode == LXZAT_VIEW_MODE_TXT)
        {
            i_nb_trywrite = (i_nb_read >> 1);
            if(!lxz_string_f_hex2bin(p_buf_data, i_nb_read, p_buf_data))
            {
                OS_DBG_LOG(("lxzdata_dollar_mynetwrite_tcphandler,lxz_string_f_hex2bin error!\r\n"));
                free(p_buf_data);
                return i_len_handled;
            }
        }
        else
        {
            i_nb_trywrite = i_nb_read;
        }

        i_len_handled = osp_socket_f_writeto(p_sgcc_socket->it_socket_fd, p_buf_data,
                i_nb_trywrite, p_sgcc_socket->pt_ip_peer, p_sgcc_socket->ut_peer_port);
        p_sgcc_socket->it_socket_state = E_LESS_ESTABLISHED;
    }

    free(p_buf_data);
    if (p_cur_datacfg->p_param_ctxt != NULL)
    {
        free(p_cur_datacfg->p_param_ctxt);
        p_cur_datacfg->p_param_ctxt = NULL;
    }
    free(p_cur_datacfg);
    p_cur_spcfg->pt_di_cfg = NULL;

    lxzat_rsp_f_printf(p_cur_spcfg->i_vsp_id, LXZAT_RSP_MODE_P1N1, "OK");

    lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
    lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
        E_LSMX_ATC, LXZAT_END_CHAR_CR, LXZAT_END_CHAR_LF);

    i_len_handled = i_nb_read;
    return i_len_handled;
}

/*
 *  Description:
 *    The 2nd step of "AT$MYNETCREATE".
 *  Param: p_data_buf, the pointer of AT command context;
 *  Param: i_data_len, the pointer of AT command context;
 *  Param: pctxt, the pointer of AT command context;
 *  Return: the number of bytes have been sent;
 *  Note: NONE
 */
static sint32 lxzdata_dollar_rawmode_tcphandler(sint32 i_end_flag, void * pctxt)
{
    sint32 i_len_handled = 0;

    uint32 i_cur_ticks = 0;
    sint32 i_nb_cached = 0;
    sint32 i_len_read = 0;
    sint32 i_buf_size = 0;
    uint08 * p_buf_data = NULL;

    sint32 i_id_socket = 0;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    p_cur_spcfg = (lxzat_spcfg_t *)pctxt;
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzdata_dollar_rawmode_tcphandler,p_cur_spcfg is NULL!\r\n"));
        return i_len_handled;
    }
    p_cur_datacfg = p_cur_spcfg->pt_di_cfg;
    if (p_cur_datacfg == NULL)
    {
        OS_DBG_LOG(("lxzdata_dollar_rawmode_tcphandler,p_cur_datacfg is NULL!\r\n"));
        return i_len_handled;
    }

    i_nb_cached = lxz_ring_f_getoption(p_cur_spcfg->pt_rx_ring, E_LRO_DATA_SIZE);
    if(i_end_flag == LXZAT_STREAM_EFLAG_NONE)
    {
        if (i_nb_cached == 0)
        {
            OS_DBG_LOG(("lxzdata_dollar_rawmode_tcphandler,i_nb_cached:%d\r\n",i_nb_cached));
            p_sgcc_socket->it_mark_time = i_cur_ticks;
            return i_len_handled;
        }

        OS_DBG_LOG(("lxzdata_dollar_rawmode_tcphandler,i_end_flag is :%d\r\n",i_end_flag));
        i_cur_ticks = osp_time_tickget();
        i_id_socket = *((sint32 *)(p_cur_datacfg->p_param_ctxt));
        if ((i_id_socket >= 0) && (i_id_socket < LXZAT_SGCC_NUM_MAX))
        {
            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            p_sgcc_socket->it_socket_state = E_LESS_SENDING;

            i_buf_size = gs_sgcc_rawmode_table[p_sgcc_socket->it_channel_id].it_rawmode_nbbytes;
            if (i_nb_cached >= i_buf_size)
            {
                i_buf_size = i_nb_cached;
            }

            p_buf_data = (uint08 *)malloc(i_buf_size);
            if (p_buf_data == NULL)
            {
                OS_DBG_LOG(("lxzdata_dollar_rawmode_tcphandler,p_buf_data malloc error!\r\n"));
                p_sgcc_socket->it_mark_time = i_cur_ticks;
                return i_len_handled;
            }

            i_len_read = lxz_ring_f_read(p_cur_spcfg->pt_rx_ring, p_buf_data, i_buf_size);
            if (0 == i_len_read)
            {
                OS_DBG_LOG(("lxzdata_dollar_rawmode_tcphandler,lxz_ring_f_read:i_len_read:%d\r\n",i_len_read));
                p_sgcc_socket->it_mark_time = i_cur_ticks;
                free(p_buf_data);
                return i_len_handled;
            }
            p_sgcc_socket->it_mark_time = i_cur_ticks;
            i_len_handled = osp_socket_f_write(p_sgcc_socket->it_socket_fd, p_buf_data, i_len_read);
            free(p_buf_data);
        }

        return i_len_handled;
    }
    else
    {
        OS_DBG_LOG(("lxzdata_dollar_rawmode_tcphandler,i_end_flag is :%d\r\n",i_end_flag));
        if (i_nb_cached == 0)
        {
            i_id_socket = *((sint32 *)(p_cur_datacfg->p_param_ctxt));
            if ((i_id_socket >= 0) && (i_id_socket < LXZAT_SGCC_NUM_MAX))
            {
                p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
                p_sgcc_socket->it_socket_state = E_LESS_ESTABLISHED;
            }

            lxzat_rsp_f_printf(p_cur_spcfg->i_vsp_id, LXZAT_RSP_MODE_P1N1, "OK");
            lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
            lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
            E_LSMX_ATC, LXZAT_END_CHAR_CR, LXZAT_END_CHAR_LF);
            return i_len_handled;
        }

        i_buf_size = i_nb_cached;
        p_buf_data = (uint08 *)malloc(i_buf_size);
        if (p_buf_data == NULL)
        {
            OS_DBG_LOG(("lxzdata_dollar_rawmode_tcphandler,p_data_buf malloc error!\r\n"));
            return i_len_handled;
        }

        i_len_read = lxz_ring_f_read(p_cur_spcfg->pt_rx_ring, p_buf_data, i_buf_size);
        if (0 == i_len_read)
        {
            OS_DBG_LOG(("lxzdata_dollar_rawmode_tcphandler,lxz_ring_f_read:i_len_read:%d\r\n",i_len_read));
            free(p_buf_data);
            return i_len_handled;
        }

        i_id_socket = *((sint32 *)(p_cur_datacfg->p_param_ctxt));
        if ((i_id_socket >= 0) && (i_id_socket < LXZAT_SGCC_NUM_MAX))
        {
            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);

            i_len_handled = osp_socket_f_write(p_sgcc_socket->it_socket_fd, p_buf_data, i_len_read);
            p_sgcc_socket->it_socket_state = E_LESS_ESTABLISHED;
        }
        free(p_buf_data);

        lxzat_rsp_f_printf(p_cur_spcfg->i_vsp_id, LXZAT_RSP_MODE_P1N1, "OK");
        lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
        lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
            E_LSMX_ATC, LXZAT_END_CHAR_CR, LXZAT_END_CHAR_LF);
    }

    return i_len_handled;
}

/*
 *  Description:
 *    The 2nd step of "AT$MYNETCREATE".
 *  Param: p_data_buf, the pointer of AT command context;
 *  Param: i_data_len, the pointer of AT command context;
 *  Param: pctxt, the pointer of AT command context;
 *  Return: the number of bytes have been sent;
 *  Note: NONE
 */
static sint32 lxzdata_dollar_rawmode_udphandler(sint32 i_end_flag, void * pctxt)
{
    sint32 i_len_handled = 0;
    uint32 i_cur_ticks = 0;

    sint32 i_nb_cached = 0;
    sint32 i_len_read = 0;
    sint32 i_buf_size = 0;
    uint08 * p_buf_data = NULL;
    
    sint32 i_id_socket = 0;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    p_cur_spcfg = (lxzat_spcfg_t *)pctxt;
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzdata_dollar_rawmode_udphandler,p_cur_spcfg is NULL !r\n"));
        return i_len_handled;
    }

    p_cur_datacfg = p_cur_spcfg->pt_di_cfg;
    if (p_cur_datacfg == NULL)
    {
        OS_DBG_LOG(("lxzdata_dollar_rawmode_udphandler,p_cur_datacfg is NULL !r\n"));
        return i_len_handled;
    }

    i_id_socket = *((sint32 *)(p_cur_datacfg->p_param_ctxt));
    if (i_id_socket > LXZAT_SGCC_NUM_MAX)
    {
        OS_DBG_LOG(("lxzdata_dollar_rawmode_udphandler,i_id_socket:%d!r\n", i_id_socket));
        return i_len_handled;
    }

    i_nb_cached = lxz_ring_f_getoption(p_cur_spcfg->pt_rx_ring, E_LRO_DATA_SIZE);
    if(i_end_flag == LXZAT_STREAM_EFLAG_NONE)
    {
        OS_DBG_LOG(("lxzdata_dollar_rawmode_udphandler,i_end_flag is :%d\r\n",i_end_flag));
        i_cur_ticks = osp_time_tickget();
        p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
        p_sgcc_socket->it_socket_state = E_LESS_SENDING;
        
        if (i_nb_cached == 0)
        {
            OS_DBG_LOG(("lxzdata_dollar_rawmode_tcphandler,i_nb_cached:%d\r\n",i_nb_cached));
            p_sgcc_socket->it_mark_time = i_cur_ticks;
            return i_len_handled;
        }

        p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
        p_sgcc_socket->it_socket_state = E_LESS_SENDING;
        i_buf_size = gs_sgcc_rawmode_table[p_sgcc_socket->it_channel_id].it_rawmode_nbbytes;
        if (i_nb_cached > i_buf_size)
        {
            i_buf_size = i_nb_cached;
        }

        p_buf_data = (uint08 *)malloc(i_buf_size);
        if (p_buf_data == NULL)
        {
            OS_DBG_LOG(("lxzdata_dollar_rawmode_udphandler,p_buf_data malloc error!\r\n"));
            p_sgcc_socket->it_mark_time = i_cur_ticks;
            return i_len_handled;
        }

        i_len_read = lxz_ring_f_read(p_cur_spcfg->pt_rx_ring, p_buf_data, i_buf_size);
        if (i_buf_size != i_len_read)
        {
            OS_DBG_LOG(("lxzdata_dollar_rawmode_udphandler,lxz_ring_f_read,i_len_read:%d\r\n",i_len_read));
            p_sgcc_socket->it_mark_time = i_cur_ticks;
            return i_len_handled;
        }

        p_sgcc_socket->it_mark_time = i_cur_ticks;
        i_len_handled = osp_socket_f_writeto(p_sgcc_socket->it_socket_fd, p_buf_data,
            i_len_read,p_sgcc_socket->pt_ip_peer,
            p_sgcc_socket->ut_peer_port);
        free(p_buf_data);

        return i_len_handled;
    }
    else
    {
        OS_DBG_LOG(("lxzdata_dollar_rawmode_udphandler,i_end_flag is :%d\r\n",i_end_flag));
        
        if (i_nb_cached == 0)
        {
            i_id_socket = *((sint32 *)(p_cur_datacfg->p_param_ctxt));
            if ((i_id_socket >= 0) && (i_id_socket < LXZAT_SGCC_NUM_MAX))
            {
                p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
                p_sgcc_socket->it_socket_state = E_LESS_ESTABLISHED;
            }
            if (p_cur_datacfg->p_param_ctxt != NULL)
            {
                free(p_cur_datacfg->p_param_ctxt);
                p_cur_datacfg->p_param_ctxt = NULL;
            }

            free(p_cur_datacfg);
            p_cur_spcfg->pt_di_cfg = NULL;
            lxzat_rsp_f_printf(p_cur_spcfg->i_vsp_id, LXZAT_RSP_MODE_P1N1, "OK");
            lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
            lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
            E_LSMX_ATC, LXZAT_END_CHAR_CR, LXZAT_END_CHAR_LF);
            return i_len_handled;
        }

        i_buf_size = i_nb_cached;
        p_buf_data = (uint08 *)malloc(i_buf_size);
        if (p_buf_data == NULL)
        {
             OS_DBG_LOG(("lxzdata_dollar_rawmode_udphandler,p_buf_data malloc error!\r\n"));
            return i_len_handled;
        }

        i_len_read = lxz_ring_f_read(p_cur_spcfg->pt_rx_ring, p_buf_data, i_buf_size);
        if (i_buf_size != i_len_read)
        {
            OS_DBG_LOG(("lxzdata_dollar_rawmode_udphandler,lxz_ring_f_read,i_len_read:%d\r\n",i_len_read));
            return i_len_handled;
        }

        i_id_socket = *((sint32 *)(p_cur_datacfg->p_param_ctxt));
        if ((i_id_socket >= 0) && (i_id_socket < LXZAT_SGCC_NUM_MAX))
        {
            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            i_len_handled = osp_socket_f_writeto(p_sgcc_socket->it_socket_fd, p_buf_data,
                i_len_read,p_sgcc_socket->pt_ip_peer,
                    p_sgcc_socket->ut_peer_port);

            p_sgcc_socket->it_socket_state = E_LESS_ESTABLISHED;
        }
        free(p_buf_data);
        p_sgcc_socket->it_socket_state = E_LESS_ESTABLISHED;
        if (p_cur_datacfg->p_param_ctxt != NULL)
        {
            free(p_cur_datacfg->p_param_ctxt);
            p_cur_datacfg->p_param_ctxt = NULL;
        }

        free(p_cur_datacfg);
        p_cur_spcfg->pt_di_cfg = NULL;
        lxzat_rsp_f_printf(p_cur_spcfg->i_vsp_id, LXZAT_RSP_MODE_P1N1, "OK");
        lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
        lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
            E_LSMX_ATC, LXZAT_END_CHAR_CR, LXZAT_END_CHAR_LF);
    }
    return i_len_handled;

}

static sint32 lxzdata_dollar_myftpput_handler(sint32 i_end_flag, void * pctxt)
{
    sint32 i_len_handled = 0;

    sint32 i_nb_cached = 0;
    sint32 i_len_read = 0;
    sint32 i_buf_size = 0;
    uint08 * p_buf_data = NULL;

    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxz_easyftp_t * p_eftp_context = NULL;

    p_cur_spcfg = (lxzat_spcfg_t *)pctxt;
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzdata_dollar_myftpput_handler,p_cur_spcfg is NULL!\r\n"));
        return i_len_handled;
    }
    p_cur_datacfg = p_cur_spcfg->pt_di_cfg;
    if (p_cur_datacfg == NULL)
    {
        OS_DBG_LOG(("lxzdata_dollar_myftpput_handler,p_cur_datacfg is NULL!\r\n"));
        return i_len_handled;
    }

    p_eftp_context = gsp_eftp_context;
    if (p_eftp_context == NULL)
    {
        OS_DBG_LOG(("lxzdata_dollar_myftpput_handler,p_eftp_context is NULL!\r\n"));
        return i_len_handled;
    }

    i_nb_cached = lxz_ring_f_getoption(p_cur_spcfg->pt_rx_ring, E_LRO_DATA_SIZE);
    if(i_end_flag != LXZAT_STREAM_EFLAG_3PLUS)
    {
        if (i_nb_cached == 0)
        {
            OS_DBG_LOG(("lxzdata_dollar_myftpput_handler,i_nb_cached:%d\r\n",i_nb_cached));
            return i_len_handled;
        }

        OS_DBG_LOG(("lxzdata_dollar_myftpput_handler,i_end_flag is :%d\r\n",i_end_flag));
        i_buf_size = gsp_eftp_context->i_len_trywrite;
        p_buf_data = (uint08 *)malloc(i_buf_size);
        if (p_buf_data == NULL)
        {
            OS_DBG_LOG(("lxzdata_dollar_myftpput_handler,p_buf_data malloc error!\r\n"));
            return i_len_handled;
        }
        
        i_len_read = lxz_ring_f_read(p_cur_spcfg->pt_rx_ring, p_buf_data, i_buf_size);
        if (i_buf_size != i_len_read)
        {
            OS_DBG_LOG(("lxzdata_dollar_myftpput_handler,lxz_ring_f_read:i_len_read:%d\r\n",i_len_read));
            free(p_buf_data);
            return i_len_handled;
        }
        
        osp_socket_f_write(gsp_eftp_context->it_data_socket, p_buf_data, i_len_read);

        lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
        lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
            E_LSMX_ATC, LXZAT_END_CHAR_CR, LXZAT_END_CHAR_LF);
        lxzat_rsp_f_printf(p_cur_spcfg->i_vsp_id, LXZAT_RSP_MODE_P1N1, "OK");

        if (p_eftp_context->i_eof_trywrite == 1)
        {
            eftp_ftpdata_f_close(p_eftp_context);
            if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
            {
                lxzat_urc_f_printf(p_cur_spcfg->i_vsp_id, LXZAT_RSP_MODE_P1N1, "%s", "$MYURCFTP: 1");
            }
        }

        return i_len_handled;
    }
    else
    {
        OS_DBG_LOG(("lxzdata_dollar_myftpput_handler,i_end_flag is :%d\r\n",i_end_flag));

        if (p_cur_datacfg->p_param_ctxt != NULL)
        {
            free(p_cur_datacfg->p_param_ctxt);
            p_cur_datacfg->p_param_ctxt = NULL;
        }
        free(p_cur_datacfg);
        p_cur_spcfg->pt_di_cfg = NULL;

        eftp_ftpdata_f_close(p_eftp_context);
        lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
        lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
            E_LSMX_ATC, LXZAT_END_CHAR_CR, LXZAT_END_CHAR_LF);

        lxzat_rsp_f_printf(p_cur_spcfg->i_vsp_id, LXZAT_RSP_MODE_P1N1, "OK");
        if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
        {
            lxzat_urc_f_printf(p_cur_spcfg->i_vsp_id, LXZAT_RSP_MODE_P1N1, "%s", "$MYURCFTP: 1");
        }

        return i_len_handled;
    }

    return i_len_handled;
}

/*
 *  Description:
 *    The 2nd step of "AT$MYFTPGET".
 *  Param: p_data_buf, the pointer of AT command context;
 *  Param: i_data_len, the pointer of AT command context;
 *  Param: pctxt, the pointer of AT command context;
 *  Return: the number of bytes have been sent;
 *  Note: NONE
 */
static sint32 lxzdata_dollar_myftpget_handler(sint32 i_end_flag, void * pctxt)
{
    sint32 i_len_handled = 0;

    sint32 i_nb_cached = 0;
    sint32 i_len_read = 0;
    sint32 i_buf_size = 0;
    uint08 * p_buf_data = NULL;

    sint32 i_id_socket = 0;
    lxzat_spcfg_t * p_cur_spcfg = NULL;

    p_cur_spcfg = (lxzat_spcfg_t *)pctxt;
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzdata_dollar_myftpget_handler,p_cur_spcfg is NULL!\r\n"));
        return i_len_handled;
    }

    i_nb_cached = lxz_ring_f_getoption(p_cur_spcfg->pt_rx_ring, E_LRO_DATA_SIZE);
    if (i_nb_cached > 0)
    {
        i_len_handled = i_nb_cached;
        lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
    }

    if(i_end_flag == LXZAT_STREAM_EFLAG_3PLUS)
    {
        OS_DBG_LOG(("lxzdata_dollar_myftpget_handler,i_end_flag is :%d\r\n",i_end_flag));
        lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
            E_LSMX_ATC, LXZAT_END_CHAR_CR, LXZAT_END_CHAR_LF);
        lxzat_rsp_f_printf(p_cur_spcfg->i_vsp_id, LXZAT_RSP_MODE_P1N1, "OK");
    }

    return i_len_handled;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYPOWEROFF".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mypoweroff_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYPOWEROFF".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mypoweroff_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mypoweroff_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mypoweroff_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_EXE:
        {
            latos_reboot(p_cur_spcfg->i_vsp_id);
            break;
        }
    default:
        {
            i_err_code = E_LEC_SGCC_UNKNOWN;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYPOWEROFF".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mypoweroff_resp(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The reset handler of "AT$MYPOWEROFF".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mypoweroff_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYSOCKETLED".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mysocketled_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYSOCKETLED".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mysocketled_req(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The response handler of "AT$MYSOCKETLED".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mysocketled_resp(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The reset handler of "AT$MYSOCKETLED".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mysocketled_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYGMR".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mygmr_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYGMR".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mygmr_req(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The response handler of "AT$MYGMR".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mygmr_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mygmr_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mygmr_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_EXE:
    case LXZAT_REQ_TYPE_READ:
        {
            char llbuf[100];
            memset(llbuf, 0, sizeof(llbuf));
            strcpy(llbuf, "\r\n");
            strcat(llbuf, (char *)LXZAT_SGCC_MYGMR_MANUF);
            strcat(llbuf, "\r\n");
            strcat(llbuf,(char *)LXZAT_SGCC_MYGMR_MODEL);
            strcat(llbuf, "\r\n");
            strcat(llbuf, (char *)LXZAT_SGCC_MYGMR_SW_VER);
            strcat(llbuf, "\r\n");
            strcat(llbuf, (char *)LXZAT_SGCC_MYGMR_SW_DATE);
            strcat(llbuf, "\r\n");
            strcat(llbuf, (char *)LXZAT_SGCC_MYGMR_HW_VER);
            strcat(llbuf, "\r\n");
            strcat(llbuf, (char *)LXZAT_SGCC_MYGMR_HW_DATE);
            strcat(llbuf, "\r\nOK\r\n");

            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P0N0,
                "%s",
                llbuf);

            i_err_code = E_LEC_OK_NOTHING;
            break;
        }
    default:
        {
            i_err_code = E_LEC_SGCC_UNKNOWN;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYGMR".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mygmr_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYCCID".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myccid_init(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;

    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_resp_myccid_t * p_resp_myccid = NULL;

    if (p_lxzat_ctxt != NULL)
    {
        p_resp_myccid = (lxzat_resp_myccid_t *)malloc(sizeof(lxzat_resp_myccid_t));
        if (p_resp_myccid != NULL)
        {
            memset(p_resp_myccid, 0, sizeof(lxzat_resp_myccid_t));
            p_lxzat_ctxt->pt_rsp_data = p_resp_myccid;

            e_err_code = E_LEC_OK;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The request handler of "AT$MYCCID".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myccid_req(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_resp_myccid_t * p_resp_myccid = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myccid_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myccid_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_EXE:
        {
#ifdef LXZAT_EASYRIL_API
                uint08 u_data_buf[50] = {0};
                sint32 i_op_status = 0;
                ATResponse *p_outResponse = NULL;

                int ret = 0;
                char * line, * out;
                ATLine * p_cur_atline = NULL;
                ATLine * p_nxt_atline = NULL;


                sint32 i = 0;
                sint32 i_nb_item = 0;

                /* Step1: Send "AT^ICCID?" to C-core */
                i_op_status = (sint32)at_send_command_multiline("AT^ICCID?", "^ICCID: ", &p_outResponse);
                if(i_op_status < 0)
                {
                    OS_DBG_LOG(("lxzat:lxzat_dollar_myccid_req:AT^ICCID? error\r\n"));
                    at_response_free(p_outResponse);
                    return E_LEC_OK;
                }
                else if( p_outResponse->success == 0)
                {
                    OS_DBG_LOG(("lxzat:lxzat_dollar_myccid_req:AT^ICCID? error:%s\r\n", p_outResponse->finalResponse);
                    at_response_free(p_outResponse);
                    return E_LEC_OK;
                }
                else
                {
                    p_cur_atline = p_outResponse->p_intermediates;
                    if (p_cur_atline == NULL)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    p_nxt_atline = p_cur_atline->p_next;
                    if (p_nxt_atline != NULL)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    line = p_cur_atline->line;
                    ret = at_tok_start(&line);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    ret = at_tok_nextstr(&line, &out);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    at_response_free(p_outResponse);
                }

                /* step2: find and match, get iccid */
                p_resp_myccid = ((lxzat_resp_myccid_t *)(p_lxzat_ctxt->pt_rsp_data));
                sprintf(p_resp_myccid->u_iccid_buf, "%s", out);
#else  /* LXZAT_EASYRIL_API */
                p_resp_myccid = ((lxzat_resp_myccid_t *)(p_lxzat_ctxt->pt_rsp_data));
                sprintf(p_resp_myccid->u_iccid_buf, "%s", "89860120818621721170");
#endif /* LXZAT_EASYRIL_API */

            break;
        }

    default:
        {
            e_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYCCID".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myccid_resp(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_resp_myccid_t * p_resp_myccid = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myccid_resp,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myccid_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_EXE:
        {
            p_resp_myccid = ((lxzat_resp_myccid_t *)(p_lxzat_ctxt->pt_rsp_data));
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: \"%s\"",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                p_resp_myccid->u_iccid_buf);
            break;
        }

    default:
        {
            e_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYCCID".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myccid_reset(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;

    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_resp_myccid_t * p_resp_myccid = NULL;

    if (p_lxzat_ctxt != NULL)
    {
        p_resp_myccid = ((lxzat_resp_myccid_t *)(p_lxzat_ctxt->pt_rsp_data));
        if (p_resp_myccid != NULL)
        {
            free(p_resp_myccid);
            p_resp_myccid = NULL;

            e_err_code = E_LEC_OK;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYNETURC".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myneturc_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYNETURC".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myneturc_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myneturc_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myneturc_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            sint32 i_urc_type = 0;

            if (p_cur_req->it_nb_param != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_myneturc_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            i_urc_type = PARAM1(p_cur_req).it_number;
            if ((i_urc_type != 0) && (i_urc_type != 1))
            {
                OS_DBG_LOG(("lxzat_dollar_myneturc_req,i_urc_type is error:%d\r\n",i_urc_type));
                return E_LEC_ERR_P_OTHER;
            }

            gMyNetUrcType = i_urc_type;
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETURC".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myneturc_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myneturc_resp,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myneturc_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %d",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                gMyNetUrcType);

            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: (0,1)",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);

            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYNETURC".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myneturc_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYTYPE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytype_init(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;

    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_resp_mytype_t * p_resp_mytype = NULL;

    if (p_lxzat_ctxt != NULL)
    {
        p_resp_mytype = (lxzat_resp_mytype_t *)malloc(sizeof(lxzat_resp_mytype_t));
        if (p_resp_mytype != NULL)
        {
            memset(p_resp_mytype, 0, sizeof(lxzat_resp_mytype_t));
            p_lxzat_ctxt->pt_rsp_data = p_resp_mytype;

            e_err_code = E_LEC_OK;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The request handler of "AT$MYTYPE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytype_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    uint08 ucSupTransMode = 0x01;
    uint08 ucSupUnTransMode = 0x02;

    uint08 ucGprs = 0x01;
    uint08 ucWcdma = 0x02;
    uint08 ucTdScdma = 0x04;
    uint08 ucCdma2000 = 0x08;
    uint08 ucCdmaEvdo = 0x10;
    uint08 ucLTE = 0x20;
    uint08 ucPstn = 0x00;
    uint08 ucExtendBitFlag2 = 0x00;

    uint08 ucGps = 0x00;
    uint08 ucBeiDou = 0x00;
    uint08 ucExtendBitFlag3 = 0x00;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mytype_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mytype_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_READ:
        {
            lxzat_resp_mytype_t * p_resp_mytype = NULL;

            p_resp_mytype = p_lxzat_ctxt->pt_rsp_data;
            if (p_resp_mytype != NULL)
            {
                sint32 i_cur_typemask = 0;

                i_cur_typemask = lxzat_typemask_f_get();
                switch (i_cur_typemask)
                {
                    case 1/* Detail: 1:2G-GPRS */:
                    {
                        p_resp_mytype->i_mode =  ucSupTransMode |  ucSupUnTransMode;
                        p_resp_mytype->i_network_type = ucGprs | ucPstn | ucExtendBitFlag2;
                        p_resp_mytype->i_extended_feature = ucGps | ucBeiDou | ucExtendBitFlag3;
                        break;
                    }

                    case 5/* Detail: 5:4G-5RAT */:
                    {
                        p_resp_mytype->i_mode =  ucSupTransMode |  ucSupUnTransMode;
                        p_resp_mytype->i_network_type = ucGprs | ucWcdma | ucTdScdma/* | ucCdma2000 | ucCdmaEvdo */| ucLTE | ucPstn | ucExtendBitFlag2;
                        p_resp_mytype->i_extended_feature = ucGps | ucBeiDou | ucExtendBitFlag3;
                        break;
                    }

                    case 7/* Detail: 7:4G-7RAT */:
                    {
                        p_resp_mytype->i_mode =  ucSupTransMode |  ucSupUnTransMode;
                        p_resp_mytype->i_network_type = ucGprs | ucWcdma | ucTdScdma | ucCdma2000 | ucCdmaEvdo | ucLTE | ucPstn | ucExtendBitFlag2;
                        p_resp_mytype->i_extended_feature = ucGps | ucBeiDou | ucExtendBitFlag3;
                        break;
                    }

                    default/* U9501, 4G-5RAT */:
                    {
                        p_resp_mytype->i_mode =  ucSupTransMode |  ucSupUnTransMode;
                        p_resp_mytype->i_network_type = ucGprs | ucWcdma | ucTdScdma/* | ucCdma2000 | ucCdmaEvdo */| ucLTE | ucPstn | ucExtendBitFlag2;
                        p_resp_mytype->i_extended_feature = ucGps | ucBeiDou | ucExtendBitFlag3;
                        break;
                    }
                }
            }
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYTYPE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytype_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mytype_resp,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mytype_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_READ:
        {
            lxzat_resp_mytype_t * p_resp_mytype = NULL;

            p_resp_mytype = p_lxzat_ctxt->pt_rsp_data;
            if (p_resp_mytype != NULL)
            {
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: %02X,%02X,%02X",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    p_resp_mytype->i_mode,
                    p_resp_mytype->i_network_type,
                    p_resp_mytype->i_extended_feature);
            }
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYTYPE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytype_reset(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;

    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_resp_mytype_t * p_resp_mytype = NULL;

    if (p_lxzat_ctxt != NULL)
    {
        p_resp_mytype = p_lxzat_ctxt->pt_rsp_data;
        if (p_resp_mytype != NULL)
        {
            free(p_resp_mytype);
            p_resp_mytype = NULL;

            p_lxzat_ctxt->pt_rsp_data = NULL;
            e_err_code = E_LEC_OK;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYNETCON".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetcon_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYNETCON".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetcon_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_pdpcfg_t * p_cur_pdpcfg = NULL;
    lxzat_sgcc_rawmode_t * p_cur_srmcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetcon_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetcon_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            sint32  ucChannelId = 0;
            sint32  i_len = 0;
            sint08 * p_pos_comma = NULL;

            if (p_cur_req->it_nb_param != 3)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcon_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcon_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcon_req,param2 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            ucChannelId = PARAM1(p_cur_req).it_number;
            if(ucChannelId > LXZAT_CHANNEL_ID_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcon_req,ucChannelId=%d!\r\n", ucChannelId));
                return E_LEC_ERR_P_TOO_BIG;
            }

            p_cur_pdpcfg = lxzat_pdpcfg_f_get(ucChannelId + 1);
            p_cur_srmcfg = &(gs_sgcc_rawmode_table[ucChannelId]);
            if(0 == strcasecmp((char *)PARAM2(p_cur_req).pt_str->pt_string,(char *)"USERPWD"))
            {
                if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetcon_req,param3 type error!\r\n"));
                    return E_LEC_ERR_P_TYPE;
                }

                if (0 == PARAM3(p_cur_req).pt_str->it_length)
                {
                    memset(p_cur_pdpcfg->ut_user_name, 0, LXZAT_SGCC_USR_MAX_LEN + 1);
                    memset(p_cur_pdpcfg->ut_pass_word, 0, LXZAT_SGCC_PWD_MAX_LEN + 1);
                    return E_LEC_OK;
                }

                p_pos_comma = strchr(PARAM3(p_cur_req).pt_str->pt_string, ',');
                if (p_pos_comma == NULL)
                {
                    if(PARAM3(p_cur_req).pt_str->it_length > LXZAT_SGCC_USR_MAX_LEN)
                    {
                        return E_LEC_SGCC_PARAM_NOT_CORRECT;
                    }
                    memset(p_cur_pdpcfg->ut_user_name, 0, LXZAT_SGCC_USR_MAX_LEN + 1);
                    strcpy(p_cur_pdpcfg->ut_user_name, PARAM3(p_cur_req).pt_str->pt_string);

                    memset(p_cur_pdpcfg->ut_pass_word, 0, LXZAT_SGCC_PWD_MAX_LEN + 1);
                }
                else
                {
                    sint32 i_usr_len = 0;
                    sint32 i_pwd_len = 0;
                    i_usr_len = strlen(PARAM3(p_cur_req).pt_str->pt_string) - strlen(p_pos_comma);
                    p_pos_comma++;
                    i_pwd_len = strlen(p_pos_comma);                    
                    if ((i_usr_len >= 0 && i_usr_len <= LXZAT_SGCC_USR_MAX_LEN) && 
                        (i_pwd_len >= 0 && i_pwd_len <= LXZAT_SGCC_PWD_MAX_LEN))
                    {
                        memset(p_cur_pdpcfg->ut_pass_word, 0, LXZAT_SGCC_PWD_MAX_LEN + 1);
                        memset(p_cur_pdpcfg->ut_user_name, 0, LXZAT_SGCC_USR_MAX_LEN + 1);
                        strncpy(p_cur_pdpcfg->ut_user_name, PARAM3(p_cur_req).pt_str->pt_string, i_usr_len);
                        strcpy(p_cur_pdpcfg->ut_pass_word, p_pos_comma);
                    }
                    else
                    {
                        return E_LEC_SGCC_PARAM_NOT_CORRECT;
                    }
                }
            }
            else if(0 == strcasecmp((char *)PARAM2(p_cur_req).pt_str->pt_string,(char *)"APN"))
            {
                if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetcon_req,param3 type error!\r\n"));
                    return E_LEC_ERR_P_TYPE;
                }

                if ( 0 == PARAM3(p_cur_req).pt_str->it_length )
                {
                    memset(p_cur_pdpcfg->ut_net_apn, 0, LXZAT_SGCC_APN_MAX_LEN + 1);
                    return E_LEC_OK;
                }
                else if(PARAM3(p_cur_req).pt_str->it_length > LXZAT_SGCC_APN_MAX_LEN)
                {
                    return E_LEC_SGCC_PARAM_NOT_CORRECT;
                }
                strcpy((char *)(p_cur_pdpcfg->ut_net_apn), (char *)PARAM3(p_cur_req).pt_str->pt_string);
            }
            else if(0 == strcasecmp((char *)PARAM2(p_cur_req).pt_str->pt_string,(char *)"CFGT"))
            {
                if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetcon_req,param3 type error!\r\n"));
                    return E_LEC_ERR_P_TYPE;
                }
                if(PARAM3(p_cur_req).it_number < 1 || PARAM3(p_cur_req).it_number > 65535)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetcon_req,param3 CFGT value error!\r\n"));
                    return E_LEC_SGCC_PARAM_NOT_CORRECT;
                }
                p_cur_srmcfg->it_rawmode_timeout = PARAM3(p_cur_req).it_number;
            }
            else if(0 == strcasecmp((char *)PARAM2(p_cur_req).pt_str->pt_string,(char *)"CFGP"))
            {
                if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetcon_req,param3 type error!\r\n"));
                    return E_LEC_ERR_P_TYPE;
                }
                if(PARAM3(p_cur_req).it_number < 1 || PARAM3(p_cur_req).it_number > 1460)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetcon_req,param3 CFGP value error!\r\n"));
                    return E_LEC_SGCC_PARAM_NOT_CORRECT;
                }
                p_cur_srmcfg->it_rawmode_nbbytes = PARAM3(p_cur_req).it_number;
            }
            else if(0 == strcasecmp((char *)PARAM2(p_cur_req).pt_str->pt_string,(char *)"AUTH"))
            {
                if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetcon_req,param3 type error!\r\n"));
                    return E_LEC_ERR_P_TYPE;
                }
                if(PARAM3(p_cur_req).it_number < 0 || PARAM3(p_cur_req).it_number > 2)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetcon_req,param3 AUTH value error!\r\n"));
                    return E_LEC_SGCC_PARAM_NOT_CORRECT;
                }
                p_cur_pdpcfg->it_auth_type = PARAM3(p_cur_req).it_number;
            }
            else
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcon_req,mynetconfig other error!\r\n"));
                return E_LEC_ERR_P_OTHER;
            }

            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETCON".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetcon_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetcon_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetcon_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {

            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            sint32 i = 0;
            sint32 i_auty_type = E_LPAT_MAX;
            lxzat_pdpcfg_t * p_cur_pdpcfg = NULL;
            lxzat_sgcc_rawmode_t * p_cur_srmcfg = NULL;

            while (i <= LXZAT_CHANNEL_ID_MAX)
            {
                p_cur_pdpcfg = lxzat_pdpcfg_f_get(i + 1);
                p_cur_srmcfg = &(gs_sgcc_rawmode_table[i]);
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: %d,\"%s\",\"%s,%s\"",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    i,
                    "USERPWD",
                    p_cur_pdpcfg->ut_user_name,
                    p_cur_pdpcfg->ut_pass_word);

                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: %d,\"%s\",\"%s\"",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    i,
                    "APN",
                    p_cur_pdpcfg->ut_net_apn);

                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: %d,\"%s\",%d",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    i,
                    "CFGT",
                    p_cur_srmcfg->it_rawmode_timeout);

                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: %d,\"%s\",%d",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    i,
                    "CFGP",
                    p_cur_srmcfg->it_rawmode_nbbytes);

                i_auty_type = p_cur_pdpcfg->it_auth_type;
                if ((i_auty_type == E_LPAT_MAX) || (i_auty_type == E_LPAT_PAPCHAP))
                {
                    lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P1N0,
                        "%s: %d,\"%s\",%d",
                        p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                        i,
                        "AUTH",
                        1/*PAP*/);
                }
                else
                {
                    lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P1N0,
                        "%s: %d,\"%s\",%d",
                        p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                        i,
                        "AUTH",
                        p_cur_pdpcfg->it_auth_type);
                }

                i++;
            }
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %s,\"%s\",\"%s\"",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                "<ChannelID>",
                "<tag>",
                "<value>");
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYNETCON".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetcon_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYNETACT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetact_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYNETACT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetact_req(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_pdpcfg_t * p_cur_pdpcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetact_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetact_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            sint32 i_cid_sgcc = 0;
            sint32 i_cid_3gpp = 0;
            sint32 ucAction = 0;

            if (p_cur_req->it_nb_param != 2)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetact_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetact_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetact_req,param2 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_cid_sgcc = PARAM1(p_cur_req).it_number;
            if(i_cid_sgcc > LXZAT_CHANNEL_ID_MAX )
            {
                OS_DBG_LOG(("lxzat_dollar_mynetact_req,i_cid_sgcc=%d!\r\n", i_cid_sgcc));
                return E_LEC_ERR_P_TOO_BIG;
            }

            ucAction = PARAM2(p_cur_req).it_number;
            if ((ucAction != 0) && (ucAction != 1))
            {
                OS_DBG_LOG(("lxzat_dollar_mynetact_req,PARAM2 is error: %d\r\n",ucAction));
                return E_LEC_ERR_P_RANGE;
            }

            i_cid_3gpp = i_cid_sgcc+1;
            if(0 == ucAction)
            {
                if (LXZAT_TRUE == lxzat_sgcc_ifconfig_f_get(i_cid_sgcc, NULL))
                {
                    lxzat_pdpinfo_f_deactive(p_cur_spcfg->i_vsp_id, i_cid_3gpp);
                    lxzat_task_myurcclose_newtask(p_cur_spcfg->i_vsp_id, i_cid_3gpp);
                    lxzat_task_myurcftp_newtask(p_cur_spcfg->i_vsp_id, i_cid_3gpp);
                    lxzat_task_myurcdeact_newtask(p_cur_spcfg->i_vsp_id, i_cid_3gpp);
                }
                else
                {
                    e_err_code = E_LEC_SGCC_PDP_NO_ACTIVED;
                }
            }
            else
            {
                sint32 i_str_len = 0;
                uint08 u_apn_buf[LXZAT_SGCC_APN_MAX_LEN+1] = {0};
                uint08 u_usr_buf[LXZAT_SGCC_USR_MAX_LEN+1] = {0};
                uint08 u_pwd_buf[LXZAT_SGCC_PWD_MAX_LEN+1] = {0};
                sint32 i_auth_type = 0;
                
                sint32 i_creg_isready = 0;
                sint32 i_pdp_isactive = 0;

                i_creg_isready = lxzat_creg_f_getstatus(p_cur_spcfg->i_vsp_id);
                if(i_creg_isready == 0)
                {
                    return E_LEC_SGCC_PDP_ACTIVE_REJECT;
                }

                lxzat_pdpinfo_f_getstatus(i_cid_3gpp, &i_pdp_isactive);
                if (E_PDP_STATUS_ACTIVATING == i_pdp_isactive)
                {
                    return E_LEC_SGCC_PDP_ACTIVE_REJECT;
                }
                if (E_PDP_STATUS_ACTIVATED == i_pdp_isactive)
                {
                    return E_LEC_SGCC_PDP_ACTIVED;
                }

                lxzat_pdpinfo_f_active(p_cur_spcfg->i_vsp_id, i_cid_3gpp);
                lxzat_task_myurcact_newtask(p_cur_spcfg->i_vsp_id, i_cid_3gpp);
            }
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }

    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }

    default:
        {
            e_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETACT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetact_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetact_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetact_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }

    case LXZAT_REQ_TYPE_READ:
        {
            sint32 i = 0;
            sint32 i_creg_status = 0;
            lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;

            i_creg_status = lxzat_creg_f_getstatus(p_cur_spcfg->i_vsp_id);
            if(i_creg_status == 1)
            {
                while (i < LXZAT_CHANNEL_ID_MAX)
                {
                    p_cur_pdpinfo = lxzat_pdpinfo_f_get(i + 1);
                    if (E_PDP_STATUS_ACTIVATED == p_cur_pdpinfo->it_pdp_state)
                    {
                        lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                            LXZAT_RSP_MODE_P1N0,
                            "%s: %d,1,\"%s\"",
                            p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                            i,
                            p_cur_pdpinfo->pt_ip_host);
                    }

                    i = i + 1;
                }
            }
            break;
        }

    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <ChannelID>,<IsActive>",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }


    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYNETACT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetact_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYIPFILTER".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myipfilter_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYIPFILTER".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myipfilter_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myipfilter_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myipfilter_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
		 sint32 i_data_index = 0;

		switch(p_cur_req->it_nb_param)
		{
			case 4:
			{
				if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
		        {
		            OS_DBG_LOG(("lxzat_dollar_myipfilter_req,param1 type error!\r\n"));
		            return E_LEC_SGCC_PARAM_NOT_CORRECT;
		        }

		        if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
		        {
		            OS_DBG_LOG(("lxzat_dollar_myipfilter_req,param2 type error!\r\n"));
		            return E_LEC_SGCC_PARAM_NOT_CORRECT;
		        }

		        if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
		        {
		            OS_DBG_LOG(("lxzat_dollar_myipfilter_req,param3 type error!\r\n"));
		            return E_LEC_SGCC_PARAM_NOT_CORRECT;
		        }

		        if (PARAM4_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
		        {
		            OS_DBG_LOG(("lxzat_dollar_myipfilter_req,param4 type error!\r\n"));
		            return E_LEC_SGCC_PARAM_NOT_CORRECT;
		        }

		        i_data_index = PARAM1(p_cur_req).it_number;

		        if(i_data_index >= AT_MyIpFilter_MAX_NUM )
		        {
		            OS_DBG_LOG(("lxzat_dollar_myipfilter_req,i_data_index=%d\r\n",i_data_index));
		            return E_LEC_SGCC_PARAM_NOT_CORRECT;
		        }

		        switch(PARAM2(p_cur_req).it_number)
		        {
		        case AT_MYFILTER_OPYPE_DEL:
		            {
		                memset(&gastMyIpFilterInfo[i_data_index], 0, sizeof(lxzat_myipfilter_t));

		                break;
		            }
		        case AT_MYFILTER_OPYPE_ADD_EDIT:
		            {
		                if( (NULL != PARAM3(p_cur_req).pt_str )
		                    &&( PARAM3(p_cur_req).pt_str->it_length > 0 ))
		                {
		                    strcpy((char *)gastMyIpFilterInfo[i_data_index].ip_address, (char *)PARAM3(p_cur_req).pt_str->pt_string);
		                }

		                if( (NULL != PARAM4(p_cur_req).pt_str )
		                    &&( PARAM4(p_cur_req).pt_str->it_length > 0 ))
		                {
		                    strcpy((char *)gastMyIpFilterInfo[i_data_index].net_mask, (char *)PARAM4(p_cur_req).pt_str->pt_string);
		                }
		                gastMyIpFilterInfo[i_data_index].act_flag = 1;
		                break;
		            }
		        case AT_MYFILTER_OPYPE_DEL_ALL:
		            {
		                uint08 i_index = 0;
		                for( i_index = 0; i_index < AT_MyIpFilter_MAX_NUM; i_index ++)
		                {
		                    memset(&gastMyIpFilterInfo[i_index], 0, sizeof(lxzat_myipfilter_t));
		                }
		                break;
		            }
		        default:
		            {
		                i_err_code = E_LEC_ERR_P_TOO_BIG;
		                break;
		            }

		        }

		        break;
			}
			case 3:
			case 2:
			{
				if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
		        {
		            OS_DBG_LOG(("lxzat_dollar_myipfilter_req,param1 type error!\r\n"));
		            return E_LEC_SGCC_PARAM_NOT_CORRECT;
		        }
				i_data_index = PARAM1(p_cur_req).it_number;

		        if(i_data_index >= AT_MyIpFilter_MAX_NUM )
		        {
		            OS_DBG_LOG(("lxzat_dollar_myipfilter_req,i_data_index=%d\r\n",i_data_index));
		            return E_LEC_SGCC_PARAM_NOT_CORRECT;
		        }
				if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
		        {
		            OS_DBG_LOG(("lxzat_dollar_myipfilter_req,param2 type error!\r\n"));
		            return E_LEC_SGCC_PARAM_NOT_CORRECT;
		        }
				if((PARAM2(p_cur_req).it_number < 0) || (PARAM2(p_cur_req).it_number > 2))
				{
					OS_DBG_LOG(("lxzat_dollar_myipfilter_req,param2 num error!\r\n"));
		            return E_LEC_SGCC_PARAM_NOT_CORRECT;
				}
				if((0 != PARAM2(p_cur_req).it_number) && (2 != PARAM2(p_cur_req).it_number))
				{
					return E_LEC_SGCC_PARAM_NOT_CORRECT;
				}
				if(0 == PARAM2(p_cur_req).it_number)
				{
					memset(&gastMyIpFilterInfo[i_data_index], 0, sizeof(lxzat_myipfilter_t));
				}
				if(2 == PARAM2(p_cur_req).it_number)
				{
					uint08 i_del_index = 0;
					for( i_del_index = 0; i_del_index < AT_MyIpFilter_MAX_NUM; i_del_index++)
					{
						memset(&gastMyIpFilterInfo[i_del_index], 0, sizeof(lxzat_myipfilter_t));
					}
				}
				break;
			}
			default:
			{
				return E_LEC_SGCC_PARAM_NOT_CORRECT;
			}
		}
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }

    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYIPFILTER".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myipfilter_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myipfilter_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myipfilter_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }

    case LXZAT_REQ_TYPE_READ:
        {
            sint32 ucConIndex = 0;

            for (ucConIndex = 0; ucConIndex <5; ucConIndex ++)
            {
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: %d,\"%s\",\"%s\"",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    ucConIndex,
                    gastMyIpFilterInfo[ucConIndex].ip_address,
                    gastMyIpFilterInfo[ucConIndex].net_mask);
            }
            break;
        }

    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <id>,<ip_address>,<net_mask>",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword
                );
            break;
        }


    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYIPFILTER".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myipfilter_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYNETSRV".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetsrv_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYNETSRV".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetsrv_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_channel_id = 0;
    sint32 i_id_socket = 0;
    sint32 i_net_type = 0;
    sint32 i_view_mode = 0;
    uint08 * p_dst_addr = NULL;
    uint16 u_peer_port = 0;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_str_len = 0;
    sint32 i_pos_find = 0;

    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            if (p_cur_req->it_nb_param != 5)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,param2 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,param3 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM4_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,param4 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM5_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,param5 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_channel_id = PARAM1(p_cur_req).it_number;
            if(i_channel_id < LXZAT_CHANNEL_ID_MIN || i_channel_id > LXZAT_CHANNEL_ID_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,i_channel_id=%d\r\n",i_channel_id));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            i_id_socket = PARAM2(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            i_net_type = PARAM3(p_cur_req).it_number;
            if(i_net_type < 0 || i_net_type > LXZAT_NET_TYPE_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,i_net_type=%d\r\n",i_net_type));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            i_view_mode = PARAM4(p_cur_req).it_number;
            if(i_view_mode != LXZAT_VIEW_MODE_HEX && i_view_mode > LXZAT_VIEW_MODE_TXT)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,i_view_mode=%d\r\n",i_view_mode));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            i_str_len = PARAM5(p_cur_req).pt_str->it_length;
            if(i_str_len <= 0 || i_str_len > LXZAT_URL_LENGTH_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,i_dns_len=%d\r\n",i_str_len));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            if (   (p_sgcc_socket->it_socket_state != E_LESS_IDLE)
                && (p_sgcc_socket->it_socket_state != E_LESS_CONFIG))
            {
                OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,socket is already exist!\r\n"));
                return E_LEC_SGCC_SOCKET_CONNECT;
            }

            if(p_sgcc_socket->it_socket_state == E_LESS_CONFIG)
            {
                if(p_sgcc_socket->pt_peer_url != NULL)
                {
                    free(p_sgcc_socket->pt_peer_url);
                    p_sgcc_socket->pt_peer_url = NULL;
                }
            }

            memset(p_sgcc_socket, 0, sizeof(lxzat_sgcc_socket_t));
            p_dst_addr = (uint08 *)malloc(i_str_len + 1);
            if (p_dst_addr == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,p_dst_addr malloc error!\r\n"));
                return E_LEC_ERR_MEM_MALLOC;
            }

            memset(p_dst_addr, 0, i_str_len + 1);
            lxz_dstring_get(PARAM5(p_cur_req).pt_str, p_dst_addr, i_str_len + 1);

            i_pos_find = lxz_string_f_strkpos(p_dst_addr, ':');
            if (i_pos_find != -1)
            {
                p_dst_addr[i_pos_find] = '\0';
                u_peer_port = atoi(&(p_dst_addr[i_pos_find+1]));
            }

            if((i_net_type == LXZAT_NET_TYPE_TCPS))
            {
                if(0 !=strcmp(p_dst_addr,"127.0.0.1"))
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetsrv_req,set tcp server ip set error!\r\n"));
                    free(p_dst_addr);
                    p_dst_addr = NULL;
                    return E_LEC_SGCC_PARAM_NOT_CORRECT;
                }
                p_sgcc_socket->ut_local_port = u_peer_port;
            }

            p_sgcc_socket->it_channel_id = i_channel_id;
            p_sgcc_socket->it_socket_id  = i_id_socket;
            p_sgcc_socket->it_net_type   = i_net_type;
            p_sgcc_socket->it_view_mode  = i_view_mode;
            p_sgcc_socket->pt_peer_url  = p_dst_addr;
            p_sgcc_socket->ut_peer_port  = u_peer_port;
            p_sgcc_socket->it_vsp_id = p_lxzat_ctxt->it_vsp_id;
            p_sgcc_socket->it_socket_state = E_LESS_CONFIG;
            break;
        }

    default:
        {
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETSRV".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetsrv_resp(void * pctxt)
{

    sint32 i_id_socket = 0;
    sint32 i_err_code = E_LEC_OK;
    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    uint08 p_peer_url[LXZAT_URL_LENGTH_MAX];
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;


    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetsrv_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetsrv_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            for (i_id_socket=0;i_id_socket<LXZAT_SGCC_NUM_MAX;i_id_socket++)
            {
                p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
                if(p_sgcc_socket->it_socket_state > E_LESS_IDLE)
                {
                    memset(p_peer_url, 0, sizeof(p_peer_url));
                    if(p_sgcc_socket->it_net_type == LXZAT_NET_TYPE_TCPS &&
                        p_sgcc_socket->it_socket_state > E_LESS_CONFIG)
                    {
                        sprintf(p_peer_url,"%s:%d",p_sgcc_socket->pt_peer_url,p_sgcc_socket->ut_local_port);
                    }
                    else
                    {
                        sprintf(p_peer_url,"%s:%d",p_sgcc_socket->pt_peer_url,p_sgcc_socket->ut_peer_port);
                    }
                    lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P1N0,
                        "%s: %d,%d,%d,%d,\"%s\"",
                        p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,p_sgcc_socket->it_channel_id,
                        p_sgcc_socket->it_socket_id,p_sgcc_socket->it_net_type,p_sgcc_socket->it_view_mode,
                        p_peer_url);
                }
            }

            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %s,%s,%s,%s,\"%s\"",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                "<ChannelID>",
                "<SocketID>",
                "<Lay3Type>",
                "<ViewMode>",
                "<URL:PORT>");
            break;
        }

    default:
        {
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYNETSRV".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetsrv_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYNETOPEN".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetopen_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYNETOPEN".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetopen_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_channel_id = 0;
    sint32 i_id_socket = 0;
    sint32 i_net_type = 0;
    sint32 i_view_mode = 0;
    uint08 * p_dst_addr = NULL;
    uint16 u_peer_port = 0;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_flag_isactive = 0;
    sint32 i_op_status = 0;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetopen_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetopen_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            if (p_cur_req->it_nb_param != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetopen_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetopen_req,PARAM1_TYPE error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetopen_req,i_id_socket out of range:%d\r\n",i_id_socket));
                return E_LEC_ERR_UNSUPPORTED;
            }

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            if (p_sgcc_socket->it_socket_state != E_LESS_CONFIG)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetopen_req,socket state error:%d\r\n",p_sgcc_socket->it_socket_state));
                if (p_sgcc_socket->it_socket_state == E_LESS_IDLE)
                {
                    return E_LEC_SGCC_DNS_NOT_FOUND;
                }
                else
                {
                    return E_LEC_SGCC_SOCKET_CONNECT;
                }
            }

            p_sgcc_socket->pt_rxbuf = (uint08 *)malloc(LXZAT_TRYREAD_LEN_MAX);
            if(p_sgcc_socket->pt_rxbuf == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetopen_req,pt_rxbuf malloc error\r\n"));
                return E_LEC_ERR_MEM_MALLOC;
            }

            p_sgcc_socket->it_rxbuf_size = LXZAT_TRYREAD_LEN_MAX;

            switch (p_sgcc_socket->it_net_type)
            {
            case LXZAT_NET_TYPE_TCPC:
                {
                    sint32 i_snd_buf_size = 0;
                    sint32 i_opt_size = 0;
                    
                    if(osp_gethostbyname(p_sgcc_socket->pt_peer_url,p_sgcc_socket->pt_ip_peer) != 1)
                    {
                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        OS_DBG_LOG(("lxzat_dollar_mynetopen_req,tcpc gethostbyname error\r\n"));
                        return E_LEC_SGCC_DNS_TIMEOUT;
                    }

                    p_sgcc_socket->it_socket_fd = osp_socket_f_open(2/*AF_INET*/, 1/*SOCK_STREAM*/,0);
                    if (p_sgcc_socket->it_socket_fd == 0)
                    {
                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        OS_DBG_LOG(("lxzat_dollar_mynetopen_req,tcpc create socket error:%d\r\n",p_sgcc_socket->it_socket_fd));
                        return E_LEC_SGCC_DNS_TIMEOUT;
                    }

                    memset(p_sgcc_socket->pt_ip_host, 0, sizeof(LXZAT_IPBUF_SIZE_MAX));
                    i_flag_isactive = lxzat_sgcc_ifconfig_f_get(p_sgcc_socket->it_channel_id, p_sgcc_socket->pt_ip_host);
                    if (i_flag_isactive == LXZAT_FALSE)
                    {
                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        osp_socket_f_close(p_sgcc_socket->it_socket_fd);
                        p_sgcc_socket->it_socket_fd = 0;
                        OS_DBG_LOG(("lxzat_dollar_mynetopen_req,tcpc ifconfig get error\r\n"));
                        return E_LEC_SGCC_PDP_NO_ACTIVED;
                    }

                    i_op_status = osp_socket_f_bind(p_sgcc_socket->it_socket_fd, p_sgcc_socket->pt_ip_host, 0);
                    if (i_op_status != 1)
                    {
                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        osp_socket_f_close(p_sgcc_socket->it_socket_fd);
                        p_sgcc_socket->it_socket_fd = 0;
                        OS_DBG_LOG(("lxzat_dollar_mynetopen_req,tcpc osp_socket_f_bind error.\r\n"));
                        return E_LEC_SGCC_UNKNOWN;
                    }

                    i_op_status = osp_socket_f_connect(p_sgcc_socket->it_socket_fd,
                        p_sgcc_socket->pt_ip_peer,
                        p_sgcc_socket->ut_peer_port);
                    if (i_op_status != 1)
                    {
                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        osp_socket_f_close(p_sgcc_socket->it_socket_fd);
                        p_sgcc_socket->it_socket_fd = 0;
                        OS_DBG_LOG(("lxzat_dollar_mynetopen_req,tcpc connect socket error:%d\r\n",i_op_status));
                        return E_LEC_SGCC_TCP_CONNECT_TIMEOUT;
                    }

                    i_snd_buf_size = LXZAT_TCP_SNDBUF_SIZE;
                    i_opt_size = sizeof(sint32);
                    setsockopt(p_sgcc_socket->it_socket_fd, SOL_SOCKET, SO_SNDBUF, (const char *)(&i_snd_buf_size), i_opt_size);

                    p_sgcc_socket->it_socket_state = E_LESS_ESTABLISHED;
                    lxzat_task_tcpclient_newtask(i_id_socket);
                    break;
                }
            case LXZAT_NET_TYPE_TCPS:
                {
                    i_flag_isactive = lxzat_sgcc_ifconfig_f_get(p_sgcc_socket->it_channel_id, NULL);
                    if (i_flag_isactive == LXZAT_FALSE)
                    {
                        return E_LEC_SGCC_PDP_NO_ACTIVED;
                    }

                    i_err_code = lxzat_sgcc_tcpserver_f_create(p_lxzat_ctxt,i_id_socket);
                    break;
                }
            case LXZAT_NET_TYPE_UDPC:
                {
                    if(osp_gethostbyname(p_sgcc_socket->pt_peer_url,p_sgcc_socket->pt_ip_peer) != 1)
                    {
                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        OS_DBG_LOG(("lxzat_dollar_mynetopen_req,udpc gethostbyname error\r\n"));
                        return E_LEC_SGCC_DNS_TIMEOUT;
                    }

                    p_sgcc_socket->it_socket_fd = osp_socket_f_open(2/*AF_INET*/, 2/*SOCK_DGRAM*/,0);
                    if (p_sgcc_socket->it_socket_fd == 0)
                    {
                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        OS_DBG_LOG(("lxzat_dollar_mynetopen_req,udpc create socket error:%d\r\n",p_sgcc_socket->it_socket_fd));
                        return E_LEC_SGCC_DNS_TIMEOUT;
                    }

                    memset(p_sgcc_socket->pt_ip_host, 0, sizeof(LXZAT_IPBUF_SIZE_MAX));
                    i_flag_isactive = lxzat_sgcc_ifconfig_f_get(p_sgcc_socket->it_channel_id, p_sgcc_socket->pt_ip_host);
                    if (i_flag_isactive == LXZAT_FALSE)
                    {
                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        osp_socket_f_close(p_sgcc_socket->it_socket_fd);
                        p_sgcc_socket->it_socket_fd = 0;
                        OS_DBG_LOG(("lxzat_dollar_mynetopen_req,udpc ifconfig get error\r\n"));
                        return E_LEC_SGCC_PDP_NO_ACTIVED;
                    }

                    i_op_status = osp_socket_f_bind(p_sgcc_socket->it_socket_fd, p_sgcc_socket->pt_ip_host, 0);
                    if (i_op_status != 1)
                    {
                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        osp_socket_f_close(p_sgcc_socket->it_socket_fd);
                        p_sgcc_socket->it_socket_fd = 0;
                        OS_DBG_LOG(("lxzat_dollar_mynetopen_req,udpc osp_socket_f_bind error\r\n"));
                        return E_LEC_SGCC_UNKNOWN;
                    }

                    p_sgcc_socket->it_socket_state = E_LESS_ESTABLISHED;
                    lxzat_task_udpclient_newtask(i_id_socket);
                    break;
                }
            default:
                {
                    break;
                }
            }

            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETOPEN".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetopen_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;
    sint32 i_op_status = 0;
    uint08 * pt_local_ipaddr = NULL;
    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_pdpinfo_t * p_cur_pdpinfo = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_id_socket = 0;
    sint32 i_peer_MSS = 0;
    sint32 i_data_len = 0;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetopen_resp,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetopen_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetopen_resp,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_ERR_UNSUPPORTED;
            }

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            switch(p_sgcc_socket->it_net_type)
            {
            case LXZAT_NET_TYPE_TCPC:
                {
#if 0/* def LXZAT_LINUX */
                    sint32 i_opt_size = 0;
                    i_opt_size = sizeof(sint32);

                    i_op_status = getsockopt(p_sgcc_socket->it_socket_fd, IPPROTO_TCP,
                        TCP_MAXSEG, &i_peer_MSS, &i_opt_size);
                    if (i_op_status != 0)
                    {
                        i_peer_MSS = SGCC_MSS_VALUE;
                    }
#else /* LXZAT_LINUX */
                    i_peer_MSS = SGCC_MSS_VALUE;
#endif /* LXZAT_LINUX */

                    lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P1N0,
                        "%s: %d,%d",
                        p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                        i_id_socket,
                        i_peer_MSS);
                    break;
                }
            case LXZAT_NET_TYPE_TCPS:
            case LXZAT_NET_TYPE_UDPC:
                {
                    lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P1N0,
                        "%s: %d",
                        p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                        i_id_socket);
                    break;
                }
            default:
                {
                    i_err_code = E_LEC_SGCC_UNKNOWN;
                    break;
                }
            }
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            for(i_id_socket=0;i_id_socket<6;i_id_socket++)
            {
                p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
                if(p_sgcc_socket->it_socket_state>E_LESS_CONFIG)
                {
                    pt_local_ipaddr=(uint08 *)malloc(16*sizeof(uint08));
                    if(pt_local_ipaddr == NULL)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetopen_resp,pt_local_ipaddr malloc error!\r\n"));
                        return E_LEC_ERR_UNKNOWN;
                    }
                    memset(pt_local_ipaddr,0,16);
                    if(p_sgcc_socket->it_net_type==LXZAT_NET_TYPE_TCPC ||
                        p_sgcc_socket->it_net_type==LXZAT_NET_TYPE_UDPC ||
                        p_sgcc_socket->it_net_type==LXZAT_NET_TYPE_TCPS)
                    {
                        p_cur_pdpinfo = lxzat_pdpinfo_f_get(p_sgcc_socket->it_channel_id + 1);
                        i_op_status = osp_getsockname(p_sgcc_socket->it_socket_fd,pt_local_ipaddr,&(p_sgcc_socket->ut_local_port));
                        if(i_op_status<=0)
                        {
                            free(pt_local_ipaddr);
                            OS_DBG_LOG(("lxzat_dollar_mynetopen_resp,getsockname error:%d\r\n",i_op_status));
                            return E_LEC_ERR_UNKNOWN;
                        }
                        else
                        {
                            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                                LXZAT_RSP_MODE_P1N0,
                                "%s: %d,\"%s\",%d,\"%s\",\"%s\",\"%s\",%d,\"%s\",%d",
                                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                                p_sgcc_socket->it_socket_id,
                                pt_local_ipaddr,
                                p_sgcc_socket->ut_local_port,
                                p_cur_pdpinfo->pt_ip_gateway,
                                p_cur_pdpinfo->pt_ip_1stdns,
                                p_cur_pdpinfo->pt_ip_2nddns,
                                p_sgcc_socket->it_net_type,
                                p_sgcc_socket->pt_ip_peer,
                                p_sgcc_socket->ut_peer_port);
                        }
                    }
                }
            }
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <SocketID>",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }

    default:
        {
            break;
        }
    }
    if(pt_local_ipaddr!=NULL)
    {
        free(pt_local_ipaddr);
    }
    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYNETOPEN".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetopen_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYNETREAD".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetread_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYNETREAD".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetread_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_id_socket = 0;
    sint32 i_len_read = 0;
    sint32 i_len_tryread = 0;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetread_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetread_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            if (p_cur_req->it_nb_param != 2)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetread_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetread_req,param1 type is error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetread_req,param2 type is error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetread_req,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_ERR_UNSUPPORTED;
            }

            i_len_tryread= PARAM2(p_cur_req).it_number;
            if(i_len_tryread < LXZAT_TRYREAD_LEN_MIN || i_len_tryread > LXZAT_TRYREAD_LEN_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetread_req,i_len_tryread=%d\r\n",i_len_tryread));
                return E_LEC_ERR_UNSUPPORTED;
            }

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            if (p_sgcc_socket->it_socket_state < E_LESS_ESTABLISHED)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetread_req,socket is not active\r\n"));
                return E_LEC_SGCC_SOCKET_NO_CONNECT;
            }

            if (p_sgcc_socket->it_rawmode_flag != LXZAT_FALSE)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetread_req,it_rawmode_flag != LXZAT_FALSE\r\n"));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            p_sgcc_socket->it_rxdata_len = 0;
            if (p_sgcc_socket->it_net_type == LXZAT_NET_TYPE_UDPC)
            {
                i_len_read = osp_socket_f_readfrom(p_sgcc_socket->it_socket_fd,
                    p_sgcc_socket->pt_rxbuf,i_len_tryread);
            }
            else
            {
                i_len_read = osp_socket_f_read(p_sgcc_socket->it_socket_fd,
                    p_sgcc_socket->pt_rxbuf,i_len_tryread);
            }
            p_sgcc_socket->it_rxdata_len = i_len_read;
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETREAD".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetread_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_id_socket = 0;
    sint32 i_len_read = 0;
    sint32 i_len_tryread = 0;

    uint08 * p_put_buf = NULL;
    sint32 i_put_len = 0;

    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetread_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetread_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetread_resp,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_ERR_UNSUPPORTED;
            }

            i_len_tryread= PARAM2(p_cur_req).it_number;
            if(i_len_tryread < LXZAT_TRYREAD_LEN_MIN || i_len_tryread > LXZAT_TRYREAD_LEN_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetread_resp, i_len_tryread=%d\r\n",i_len_tryread));
                return E_LEC_ERR_UNSUPPORTED;
            }

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            i_len_read = p_sgcc_socket->it_rxdata_len;

            if (i_len_read > 0)
            {
                if (i_len_read < i_len_tryread)
                {
                    p_sgcc_socket->it_urc_flag = 0;
                }

                if (p_sgcc_socket->it_view_mode == LXZAT_VIEW_MODE_TXT)
                {
                    lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P1N1,
                        "%s: %d,%d",
                        p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                        i_id_socket,
                        i_len_read);
                    lxzat_rsp_f_printfhex(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P0N0,
                        p_sgcc_socket->pt_rxbuf,
                        i_len_read);
                }
                else
                {
                    lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P1N1,
                        "%s: %d,%d",
                        p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                        i_id_socket,
                        i_len_read);
                    lxzat_rsp_f_printfbin(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P0N0,
                        p_sgcc_socket->pt_rxbuf,
                        i_len_read);
                }
            }
            else
            {
                p_sgcc_socket->it_urc_flag = 0;
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: %d,%d",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    i_id_socket,
                    0);
            }

            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <SocketID>,<iLengthTryRead>",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }

    default:
        {
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYNETREAD".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetread_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYNETWRITE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetwrite_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYNETWRITE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetwrite_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_id_socket = 0;
    sint32 i_write_len = 0;
    sint32 i_data_len = 0;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            if (p_cur_req->it_nb_param != 2)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,param2 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            i_data_len= PARAM2(p_cur_req).it_number;
            if(i_data_len < LXZAT_TRYWRITE_LEN_MIN || i_data_len > LXZAT_TRYWRITE_LEN_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,i_data_len=%d\r\n",i_data_len));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            if (p_sgcc_socket->it_socket_state != E_LESS_ESTABLISHED)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,socket is not active\r\n"));
                return E_LEC_SGCC_SOCKET_NO_CONNECT;
            }

            if (p_sgcc_socket->it_rawmode_flag != LXZAT_FALSE)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,it_rawmode_flag != LXZAT_FALSE\r\n"));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            p_cur_datacfg = (lxzdata_info_t *)malloc(sizeof(lxzdata_info_t));
            if (p_cur_datacfg == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,p_cur_datacfg malloc error!\r\n"));
                return E_LEC_ERR_MEM_MALLOC;
            }

            memset(p_cur_datacfg, 0, sizeof(lxzdata_info_t));
            p_cur_datacfg->p_param_ctxt = (lxzdata_info_t *)malloc(sizeof(sint32));
            if (p_cur_datacfg->p_param_ctxt == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,p_cur_datacfg->p_param_ctx malloc error!\r\n"));
                free(p_cur_datacfg);
                p_cur_datacfg = NULL;
                return E_LEC_ERR_MEM_MALLOC;
            }

            if (p_sgcc_socket->it_net_type == LXZAT_NET_TYPE_UDPC)
            {
                p_cur_datacfg->fp_data_handler = lxzdata_dollar_mynetwrite_udphandler;
                * ((sint32 *)p_cur_datacfg->p_param_ctxt) = i_id_socket;
            }
            else
            {
#ifdef LXZAT_LINUX
                sint32 i_op_status = 0;
                sint32 i_snd_buf_size = 0;
                sint32 i_opt_size = 0;
                sint32 i_nb_bytes_sending = 0;
                sint32 i_nb_bytes_free = 0;

                i_opt_size = sizeof(sint32);
                i_op_status = getsockopt(p_sgcc_socket->it_socket_fd, SOL_SOCKET,
                    SO_SNDBUF, &i_snd_buf_size, &i_opt_size);
                if (i_op_status != 0)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,get socket option error: %d\r\n",i_op_status));
                    free(p_cur_datacfg);
                    p_cur_datacfg = NULL;
                    return E_LEC_SGCC_UNKNOWN;
                }

                i_op_status = ioctl(p_sgcc_socket->it_socket_fd, SIOCOUTQ, (char *)&i_nb_bytes_sending);
                if (i_op_status < 0)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,get socket check cout buffer size error: %d\r\n",i_op_status));
                    free(p_cur_datacfg);
                    p_cur_datacfg = NULL;
                    return E_LEC_SGCC_UNKNOWN;
                }

                i_snd_buf_size = i_snd_buf_size/2;
                i_nb_bytes_free = i_snd_buf_size - i_nb_bytes_sending;
                if (i_nb_bytes_free < i_data_len)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetwrite_req,free buffer size is not enough!\r\n"));
                    free(p_cur_datacfg);
                    p_cur_datacfg = NULL;
                    return E_LEC_SGCC_SOCKET_BUFFER_FULL;
                }
#endif /* LXZAT_LINUX */
                p_cur_datacfg->fp_data_handler = lxzdata_dollar_mynetwrite_tcphandler;
                * ((sint32 *)p_cur_datacfg->p_param_ctxt) = i_id_socket;
            }

            if(p_sgcc_socket->it_view_mode == LXZAT_VIEW_MODE_TXT)
            {
                p_cur_spcfg->i_jump_length = i_data_len*2;
            }
            else
            {
                p_cur_spcfg->i_jump_length = i_data_len;
            }
            p_cur_spcfg->pt_di_cfg = p_cur_datacfg;
            p_cur_spcfg->i_echo_auxiliary = LXZAT_FALSE;
            p_sgcc_socket->it_socket_state = E_LESS_SENDING;

            lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
            lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
                    E_LSMA_FIXED_LEN, 0, 0);
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETWRITE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetwrite_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_id_socket = 0;
    sint32 i_read_len = 0;
    sint32 i_data_len = 0;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetwrite_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetwrite_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            i_id_socket = PARAM1(p_cur_req).it_number;
            i_data_len = PARAM2(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwrite_resp,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_ERR_UNSUPPORTED;
            }

            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N1,
                "%s: %d,%d",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                i_id_socket,
                i_data_len);

            i_err_code = E_LEC_OK_NOTHING;
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <SocketID>,<iLengthTryWrite>",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNKNOWN;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYNETWRITE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetwrite_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYNETCLOSE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetclose_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYNETCLOSE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetclose_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_channel_id = 0;
    sint32 i_id_socket = 0;
    sint32 i_csocket_id = 0;
    sint32 i_net_type = 0;
    sint32 i_view_mode = 0;
    uint08 * p_dst_addr = NULL;
    uint16 u_peer_port = 0;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;
    lxzat_sgcc_socket_t * p_sgcc_clisocket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetclose_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetclose_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            if (p_cur_req->it_nb_param != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetclose_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetclose_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetclose_req,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            if (p_sgcc_socket->it_socket_fd == 0)
            {
                lxzat_sgcc_socket_f_close(i_id_socket);
                return E_LEC_OK;
            }

            if (p_sgcc_socket->it_socket_state <= E_LESS_CONNECTING)
            {
                lxzat_sgcc_socket_f_close(i_id_socket);
                return E_LEC_OK;
            }

            if (p_sgcc_socket->it_socket_fd > 0)
            {
                lxzat_sgcc_socket_f_close(i_id_socket);
            }

            memset(p_sgcc_socket, 0, sizeof(lxzat_sgcc_socket_t));

            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETCLOSE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetclose_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_id_socket = 0;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetclose_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetclose_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetclose_resp,i_id_socket=%d!\r\n", i_id_socket));
                return E_LEC_ERR_UNSUPPORTED;
            }

            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %d",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                i_id_socket);
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <SocketID>",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNKNOWN;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYNETCLOSE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetclose_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYNETACK".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetack_init(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;

    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_resp_mynetack_t * p_resp_mynetack = NULL;

    if (p_lxzat_ctxt != NULL)
    {
        p_resp_mynetack = (lxzat_resp_mynetack_t *)malloc(sizeof(lxzat_resp_mynetack_t));
        if (p_resp_mynetack != NULL)
        {
            memset(p_resp_mynetack, 0, sizeof(lxzat_resp_mynetack_t));
            p_lxzat_ctxt->pt_rsp_data = p_resp_mynetack;

            e_err_code = E_LEC_OK;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The request handler of "AT$MYNETACK".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetack_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_channel_id = 0;
    sint32 i_id_socket = 0;
    sint32 i_net_type = 0;
    sint32 i_view_mode = 0;
    uint08 * p_dst_addr = NULL;
    uint16 u_peer_port = 0;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetack_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetack_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            if (p_cur_req->it_nb_param != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetack_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetack_req,param1 type is error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetack_req,socket id is eout of range: %d\r\n",i_id_socket));
                return E_LEC_ERR_UNSUPPORTED;
            }

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            if (p_sgcc_socket->it_net_type == LXZAT_NET_TYPE_TCPC &&
                p_sgcc_socket->it_socket_state > E_LESS_CONFIG)
            {
#ifdef LXZAT_LINUX
                sint32 i_op_status = 0;
                sint32 i_snd_buf_size = 0;
                sint32 i_opt_size = 0;
                sint32 i_nb_bytes_sending = 0;
                sint32 i_nb_bytes_free = 0;
                lxzat_resp_mynetack_t * p_resp_mynetack = NULL;

                p_resp_mynetack = p_lxzat_ctxt->pt_rsp_data;
                i_opt_size = sizeof(sint32);
                i_op_status = getsockopt(p_sgcc_socket->it_socket_fd, SOL_SOCKET,
                    SO_SNDBUF, &i_snd_buf_size, &i_opt_size);
                if (i_op_status != 0)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetack_req,get socket option: %d\r\n",i_op_status));
                    free(p_cur_datacfg);
                    p_cur_datacfg = NULL;
                    return E_LEC_SGCC_UNKNOWN;
                }

                i_op_status = ioctl(p_sgcc_socket->it_socket_fd, SIOCOUTQ, (char *)&i_nb_bytes_sending);
                if (i_op_status < 0)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetack_req,check cout buffer error: %d\r\n",i_op_status));
                    free(p_cur_datacfg);
                    p_cur_datacfg = NULL;
                    return E_LEC_SGCC_UNKNOWN;
                }

                i_snd_buf_size = i_snd_buf_size/2;
                i_nb_bytes_free = i_snd_buf_size - i_nb_bytes_sending;
                p_resp_mynetack->txdata_sending_size = i_nb_bytes_sending;
                p_resp_mynetack->txdata_free_size = i_nb_bytes_free;

#endif /* LXZAT_LINUX */
            }
            else
            {
                OS_DBG_LOG(("lxzat_dollar_mynetack_req,not support except tcpc!\r\n"));
                return E_LEC_SGCC_UNKNOWN;
            }
            break;
        }

    default:
        {
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETACK".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetack_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_id_socket = 0;
    uint32 i_len_unack = 0;
    uint32 i_len_rest  = LXZAT_TRYWRITE_LEN_MAX;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetack_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetack_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            lxzat_resp_mynetack_t * p_resp_mynetack = NULL;

            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetack_resp,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_ERR_UNSUPPORTED;
            }

            p_resp_mynetack = p_lxzat_ctxt->pt_rsp_data;
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %d,%u,%u",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                i_id_socket,
                p_resp_mynetack->txdata_sending_size,
                p_resp_mynetack->txdata_free_size);

            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            i_err_code = E_LEC_ERR_UNKNOWN;
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <SocketID>",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNKNOWN;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYNETACK".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetack_reset(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;

    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_resp_mynetack_t * p_resp_mynetack = NULL;

    if (p_lxzat_ctxt != NULL)
    {
        p_resp_mynetack = p_lxzat_ctxt->pt_rsp_data;
        if (p_resp_mynetack != NULL)
        {
            free(p_resp_mynetack);
            p_resp_mynetack = NULL;

            e_err_code = E_LEC_OK;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYNETACCEPT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetaccept_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYNETACCEPT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetaccept_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_id_socket = 0;
    sint32 i_net_type = 0;
    sint32 i_accpet_flag = 0;
    sint32 i_connect_mode = 0;
    sint32 i_accept_status = 0;
    sint32 i_op_status = 0;

    uint08 * p_dst_addr = NULL;
    uint16 u_peer_port = 0;



    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_sgcc_socket_t *p_sgcc_socket = NULL;
    lxzat_sgcc_socket_t *p_sgcc_tsocket = NULL;

    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;


    if(p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetaccept_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);

    if(p_cur_req == NULL ||  p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetaccept_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            if(p_cur_req->it_nb_param < 2 || p_cur_req->it_nb_param > 3)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetaccept_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;

            }
            if(PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetaccept_req,param1 type is error!\r\n"));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            if(PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetaccept_req,param2 type is error!\r\n"));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            if((p_cur_req->it_nb_param == 3) && (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC))
            {
                OS_DBG_LOG(("lxzat_dollar_mynetaccept_req,param3 type is error!\r\n"));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX )
            {
                OS_DBG_LOG(("lxzat_dollar_mynetaccept_req,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            i_accpet_flag = PARAM2(p_cur_req).it_number;
            if((i_accpet_flag != SGCC_CLIENT_CONNECT_ACCEPT) &&
                (i_accpet_flag != SGCC_CLIENT_CONNECT_REJECT))
            {
                OS_DBG_LOG(("lxzat_dollar_mynetaccept_req,i_accpet_flag=%d\r\n",i_accpet_flag));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            if(p_cur_req->it_nb_param == 3)
            {
                i_connect_mode = PARAM3(p_cur_req).it_number;
            }
            else if(p_cur_req->it_nb_param == 2)
            {
                i_connect_mode = SGCC_CLIENT_EMERGE;
            }
            if((i_connect_mode != SGCC_CLIENT_EMERGE)&&
                (i_connect_mode != SGCC_CLIENT_TRSP))
            {
                OS_DBG_LOG(("lxzat_dollar_mynetaccept_req,i_connect_mode=%d\r\n",i_connect_mode));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            if((p_sgcc_socket->it_socket_state <= E_LESS_CONFIG)&&
                (g_newclient_socketid>=0 && g_newclient_socketid <LXZAT_SGCC_NUM_MAX))
            {

                memcpy(p_sgcc_socket,&(gs_sgcc_socket_pool[g_newclient_socketid]),sizeof(lxzat_sgcc_socket_t));
                memset(&(gs_sgcc_socket_pool[g_newclient_socketid]),0,sizeof(lxzat_sgcc_socket_t));
                g_newclient_socketid = 0xff;
                p_sgcc_socket->it_socket_id = i_id_socket;
            }
            else
            {
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            if(p_sgcc_socket->it_socket_state == E_LESS_ESTABLISHED)
            {
                i_accept_status = lxzat_sgcc_tcpserver_f_accept(i_id_socket,i_accpet_flag,i_connect_mode);
            }

            if(i_accept_status  > 0)
            {
                if(i_accpet_flag == SGCC_CLIENT_CONNECT_ACCEPT)
                {
                    if(i_connect_mode == SGCC_CLIENT_TRSP)
                    {
                        p_cur_datacfg = (lxzdata_info_t *)malloc(sizeof(lxzdata_info_t));
                        if (p_cur_datacfg == NULL)
                        {
                            OS_DBG_LOG(("lxzat_dollar_mynetaccept_req,p_cur_datacfg malloc error!\r\n"));
                            return E_LEC_ERR_MEM_MALLOC;
                        }

                        memset(p_cur_datacfg, 0, sizeof(lxzdata_info_t));
                        p_cur_datacfg->p_param_ctxt = (sint32 *)malloc(sizeof(sint32));
                        if (p_cur_datacfg->p_param_ctxt == NULL)
                        {
                            OS_DBG_LOG(("lxzat_dollar_mynetaccept_req,p_cur_datacfg->p_param_ctxt malloc error!\r\n"));
                            free(p_cur_datacfg);
                            p_cur_datacfg = NULL;

                            return E_LEC_ERR_MEM_MALLOC;
                        }

                        lxzat_task_rawmode_tcpclient_newtask(i_id_socket);

                        p_cur_datacfg->fp_data_handler = lxzdata_dollar_rawmode_tcphandler;
                        * ((sint32 *)p_cur_datacfg->p_param_ctxt) = i_id_socket;
                        p_cur_spcfg->i_jump_length = LXZAT_TRYWRITE_LEN_MAX;
                        p_cur_spcfg->pt_di_cfg = p_cur_datacfg;
                        p_sgcc_socket->it_socket_state = E_LESS_ESTABLISHED;
                        p_cur_spcfg->i_echo_auxiliary = LXZAT_FALSE;
                        lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
                        lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
                            E_LSMA_FIXED_3PLUS, 0, 0);
                    }
                    p_sgcc_socket->it_urc_flag = 0;
                }
            }
            else
            {
                if(p_sgcc_socket->pt_peer_url != NULL)
                {
                    free(p_sgcc_socket->pt_peer_url);
                    p_sgcc_socket->pt_peer_url = NULL;
                }
                memset(p_sgcc_socket,0,sizeof(lxzat_sgcc_socket_t));
            }

            break;
        }
        case LXZAT_REQ_TYPE_READ:
            {
                break;
            }
        case LXZAT_REQ_TYPE_TEST:
            {
                break;
            }
        default:
            {
                break;
            }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETACCEPT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetaccept_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_connect_mode = 0;
    sint32 i_accpet_flag = 0;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetaccept_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetaccept_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }
    if(p_cur_req->it_nb_param == 3)
    {
        i_connect_mode = PARAM3(p_cur_req).it_number;
    }     
    i_accpet_flag = PARAM2(p_cur_req).it_number;
    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            if(i_accpet_flag == 1)
            {
                break;
            }
            if(i_connect_mode == 1)
            {
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N1,  "CONNECT");
                i_err_code = E_LEC_OK_NOTHING;
            }
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }

    default:
        {
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYNETACCEPT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetaccept_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYNETCREATE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetcreate_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYNETCREATE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetcreate_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_channel_id = 0;
    sint32 i_id_socket = 0;
    sint32 i_net_type = 0;
    sint32 i_view_mode = 0;
    uint08 * p_dst_addr = NULL;
    uint16 u_peer_port = 0;
    uint16 u_local_port = 0;

    sint32 i_str_len = 0;
    sint32 i_pos_find = 0;
    sint32 i_op_status = 0;
    sint32 i_flag_isactive = LXZAT_FALSE;


    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            if (p_cur_req->it_nb_param < 5||p_cur_req->it_nb_param > 6)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,param1 type  is error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,param2 type  is error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,param3 type  is error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM4_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,param4 type  is error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM5_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,param5 type  is error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_channel_id = PARAM1(p_cur_req).it_number;
            if(i_channel_id < LXZAT_CHANNEL_ID_MIN || i_channel_id > LXZAT_CHANNEL_ID_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,i_channel_id=%d\r\n",i_channel_id));
                return E_LEC_ERR_UNSUPPORTED;

            }

            i_net_type = PARAM2(p_cur_req).it_number;
            if(i_net_type < 0 || i_net_type > LXZAT_NET_TYPE_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,i_net_type=%d\r\n",i_net_type));
                return E_LEC_ERR_UNSUPPORTED;
            }

            i_id_socket = PARAM3(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket >= LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_ERR_UNSUPPORTED;
            }

            i_str_len = PARAM4(p_cur_req).pt_str->it_length;
            if(i_str_len <= 0 || i_str_len > LXZAT_URL_LENGTH_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,param4 length is error: %d\r\n",i_str_len));
                return E_LEC_ERR_UNSUPPORTED;
            }

            if(PARAM5(p_cur_req).it_number < 0 || PARAM5(p_cur_req).it_number > 65535)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,port is error: %d\r\n",PARAM5(p_cur_req).it_number));
                return E_LEC_ERR_UNSUPPORTED;
            }
            u_peer_port = (uint16)PARAM5(p_cur_req).it_number;

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            if((p_sgcc_socket->it_socket_state != E_LESS_IDLE)
                &&(p_sgcc_socket->it_socket_state != E_LESS_CONFIG))
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req, socket is already exist!\r\n"));
                return E_LEC_ERR_UNSUPPORTED;
            }

            p_dst_addr = (uint08 *)malloc(i_str_len + 1);
            if (p_dst_addr == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req, p_dst_addr malloc error!\r\n"));
                return E_LEC_ERR_MEM_MALLOC;
            }

            memset(p_dst_addr, 0, i_str_len + 1);
            lxz_dstring_get(PARAM4(p_cur_req).pt_str, p_dst_addr, i_str_len + 1);

            if((i_net_type == LXZAT_NET_TYPE_TCPS)&&
                (0 != strcmp(p_dst_addr,"127.0.0.1")))
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req, tcps ip set error!\r\n"));
                free(p_dst_addr);
                return E_LEC_ERR_UNSUPPORTED;
            }

            memset(p_sgcc_socket, 0, sizeof(lxzat_sgcc_socket_t));
            if(p_cur_req->it_nb_param == 6)
            {
                if (PARAM6_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,param6 type error!\r\n"));
                    return E_LEC_ERR_P_TYPE;
                }
                u_local_port = (uint16)PARAM6(p_cur_req).it_number;
                if(u_local_port < 0 || u_local_port > 65535)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,local port error: %d\r\n",u_local_port));
                    return E_LEC_ERR_UNSUPPORTED;
                }
            }
            else
            {
                u_local_port = u_peer_port;
            }

            p_sgcc_socket->it_channel_id = i_channel_id;
            p_sgcc_socket->it_socket_id  = i_id_socket;
            p_sgcc_socket->it_net_type   = i_net_type;
            p_sgcc_socket->it_view_mode  = i_view_mode;
            p_sgcc_socket->ut_local_port  = u_local_port;
            p_sgcc_socket->pt_peer_url  = p_dst_addr;
            p_sgcc_socket->ut_peer_port  = u_peer_port;
            p_sgcc_socket->it_vsp_id = p_lxzat_ctxt->it_vsp_id;

            p_sgcc_socket->pt_rxbuf= (uint08 *)malloc(LXZAT_TRYREAD_LEN_MAX);
            if(p_sgcc_socket->pt_rxbuf == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,p_sgcc_socket->pt_rxbuf malloc error!\r\n"));
                free(p_sgcc_socket->pt_peer_url);
                p_sgcc_socket->pt_peer_url = NULL;

                return E_LEC_ERR_MEM_MALLOC;
            }

            p_cur_datacfg = (lxzdata_info_t *)malloc(sizeof(lxzdata_info_t));
            if (p_cur_datacfg == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,p_cur_datacfg malloc error!\r\n"));
                free(p_sgcc_socket->pt_peer_url);
                p_sgcc_socket->pt_peer_url = NULL;

                free(p_sgcc_socket->pt_rxbuf);
                p_sgcc_socket->pt_rxbuf = NULL;

                return E_LEC_ERR_MEM_MALLOC;
            }

            memset(p_cur_datacfg, 0, sizeof(lxzdata_info_t));
            p_cur_datacfg->p_param_ctxt = (lxzdata_info_t *)malloc(sizeof(sint32));
            if (p_cur_datacfg->p_param_ctxt == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,p_cur_datacfg->p_param_ctxt malloc error!\r\n"));
                free(p_sgcc_socket->pt_peer_url);
                p_sgcc_socket->pt_peer_url = NULL;

                free(p_cur_datacfg);
                p_cur_datacfg = NULL;

                free(p_sgcc_socket->pt_rxbuf);
                p_sgcc_socket->pt_rxbuf = NULL;

                return E_LEC_ERR_MEM_MALLOC;
            }

            switch (p_sgcc_socket->it_net_type)
            {
            case LXZAT_NET_TYPE_TCPC:
                {
                    sint32 i_snd_buf_size = 0;
                    sint32 i_opt_size = 0;

                    if(osp_gethostbyname(p_sgcc_socket->pt_peer_url,p_sgcc_socket->pt_ip_peer) != 1)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,tcpc gethostbyname error!\r\n"));
                        free(p_sgcc_socket->pt_peer_url);
                        p_sgcc_socket->pt_peer_url = NULL;

                        free(p_cur_datacfg->p_param_ctxt);
                        free(p_cur_datacfg);
                        p_cur_datacfg = NULL;

                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        return E_LEC_SGCC_DNS_TIMEOUT;
                    }

                    p_sgcc_socket->it_socket_fd = osp_socket_f_open(2/*AF_INET*/, 1/*SOCK_STREAM*/,0);
                    if (p_sgcc_socket->it_socket_fd == 0)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,tcpc socket create error!\r\n"));
                        free(p_sgcc_socket->pt_peer_url);
                        p_sgcc_socket->pt_peer_url = NULL;

                        free(p_cur_datacfg->p_param_ctxt);
                        free(p_cur_datacfg);
                        p_cur_datacfg = NULL;

                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        return E_LEC_SGCC_DNS_TIMEOUT;
                    }

                    memset(p_sgcc_socket->pt_ip_host, 0, sizeof(LXZAT_IPBUF_SIZE_MAX));
                    i_flag_isactive = lxzat_sgcc_ifconfig_f_get(p_sgcc_socket->it_channel_id, p_sgcc_socket->pt_ip_host);
                    if (i_flag_isactive == LXZAT_FALSE)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,tcpc lxzat_sgcc_ifconfig_f_get error: %d\r\n",i_flag_isactive));
                        free(p_sgcc_socket->pt_peer_url);
                        p_sgcc_socket->pt_peer_url = NULL;

                        free(p_cur_datacfg->p_param_ctxt);
                        free(p_cur_datacfg);
                        p_cur_datacfg = NULL;

                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        osp_socket_f_close(p_sgcc_socket->it_socket_fd);
                        p_sgcc_socket->it_socket_fd = 0;

                        return E_LEC_SGCC_PDP_NO_ACTIVED;
                    }

                    i_op_status = osp_socket_f_bind(p_sgcc_socket->it_socket_fd, p_sgcc_socket->pt_ip_host, 0);
                    if (i_op_status != 1)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,tcpc osp_socket_f_bind error\r\n"));
                        free(p_sgcc_socket->pt_peer_url);
                        p_sgcc_socket->pt_peer_url = NULL;

                        free(p_cur_datacfg->p_param_ctxt);
                        free(p_cur_datacfg);
                        p_cur_datacfg = NULL;

                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        osp_socket_f_close(p_sgcc_socket->it_socket_fd);
                        p_sgcc_socket->it_socket_fd = 0;

                        return E_LEC_SGCC_UNKNOWN;
                    }

                    i_op_status = osp_socket_f_connect(p_sgcc_socket->it_socket_fd,p_sgcc_socket->pt_ip_peer,
                        p_sgcc_socket->ut_peer_port);
                    if(i_op_status != 1)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,tcpc socket connect error: %d\r\n",i_op_status));
                        free(p_sgcc_socket->pt_peer_url);
                        p_sgcc_socket->pt_peer_url = NULL;

                        free(p_cur_datacfg->p_param_ctxt);
                        free(p_cur_datacfg);
                        p_cur_datacfg = NULL;

                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        osp_socket_f_close(p_sgcc_socket->it_socket_fd);
                        p_sgcc_socket->it_socket_fd = 0;

                        return E_LEC_SGCC_TCP_CONNECT_TIMEOUT;
                    }

                    i_snd_buf_size = LXZAT_TCP_SNDBUF_SIZE;
                    i_opt_size = sizeof(sint32);
                    setsockopt(p_sgcc_socket->it_socket_fd, SOL_SOCKET, SO_SNDBUF, (const char *)&i_snd_buf_size, i_opt_size);

                    p_sgcc_socket->it_rawmode_flag= LXZAT_TRUE;
                    p_sgcc_socket->it_socket_state = E_LESS_ESTABLISHED;
                    lxzat_task_rawmode_tcpclient_newtask(i_id_socket);

                    p_cur_datacfg->fp_data_handler = lxzdata_dollar_rawmode_tcphandler;
                    * ((sint32 *)p_cur_datacfg->p_param_ctxt) = i_id_socket;
                    p_cur_spcfg->i_jump_length = LXZAT_TRYWRITE_LEN_MAX;
                    p_cur_spcfg->pt_di_cfg = p_cur_datacfg;
                    p_cur_spcfg->i_echo_auxiliary = LXZAT_FALSE;
                    lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
                    lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
                    E_LSMA_FIXED_3PLUS, 0, 0);

                    break;
                }
            case LXZAT_NET_TYPE_TCPS:
                {
                    i_flag_isactive = lxzat_sgcc_ifconfig_f_get(p_sgcc_socket->it_channel_id, NULL);
                    if (i_flag_isactive == LXZAT_FALSE)
                    {
                        return E_LEC_SGCC_PDP_NO_ACTIVED;
                    }

                    i_err_code = lxzat_sgcc_tcpserver_f_create(p_lxzat_ctxt,i_id_socket);
                    break;
                }
            case LXZAT_NET_TYPE_UDPC:
                {
                    if(osp_gethostbyname(p_sgcc_socket->pt_peer_url,p_sgcc_socket->pt_ip_peer) != 1)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,udpc gethostbyname error\r\n"));
                        free(p_sgcc_socket->pt_peer_url);
                        p_sgcc_socket->pt_peer_url = NULL;

                        free(p_cur_datacfg->p_param_ctxt);
                        free(p_cur_datacfg);
                        p_cur_datacfg = NULL;

                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        return E_LEC_SGCC_DNS_TIMEOUT;
                    }

                    p_sgcc_socket->pt_peer_url  = p_dst_addr;
                    p_sgcc_socket->ut_peer_port  = u_peer_port;
                    p_sgcc_socket->it_socket_fd = osp_socket_f_open(2/*AF_INET*/, 2/*SOCK_DGRAM*/,0);
                    if (p_sgcc_socket->it_socket_fd == 0)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,udpc socket create error\r\n"));
                        free(p_sgcc_socket->pt_peer_url);
                        p_sgcc_socket->pt_peer_url = NULL;

                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        free(p_cur_datacfg->p_param_ctxt);
                        free(p_cur_datacfg);
                        p_cur_datacfg = NULL;

                        return E_LEC_SGCC_DNS_TIMEOUT;
                    }

                    memset(p_sgcc_socket->pt_ip_host, 0, sizeof(LXZAT_IPBUF_SIZE_MAX));
                    i_flag_isactive = lxzat_sgcc_ifconfig_f_get(p_sgcc_socket->it_channel_id, p_sgcc_socket->pt_ip_host);
                    if (i_flag_isactive == LXZAT_FALSE)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,udpc lxzat_sgcc_ifconfig_f_get error: %d\r\n",i_flag_isactive));
                        free(p_sgcc_socket->pt_peer_url);
                        p_sgcc_socket->pt_peer_url = NULL;

                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        free(p_cur_datacfg->p_param_ctxt);
                        free(p_cur_datacfg);
                        p_cur_datacfg = NULL;

                        osp_socket_f_close(p_sgcc_socket->it_socket_fd);
                        p_sgcc_socket->it_socket_fd = 0;

                        return E_LEC_SGCC_PDP_NO_ACTIVED;
                    }

                    i_op_status = osp_socket_f_bind(p_sgcc_socket->it_socket_fd, p_sgcc_socket->pt_ip_host, 0);
                    if (i_op_status != 1)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetcreate_req,udpc osp_socket_f_bind error\r\n"));
                        free(p_sgcc_socket->pt_peer_url);
                        p_sgcc_socket->pt_peer_url = NULL;

                        free(p_sgcc_socket->pt_rxbuf);
                        p_sgcc_socket->pt_rxbuf = NULL;

                        free(p_cur_datacfg->p_param_ctxt);
                        free(p_cur_datacfg);
                        p_cur_datacfg = NULL;

                        osp_socket_f_close(p_sgcc_socket->it_socket_fd);
                        p_sgcc_socket->it_socket_fd = 0;

                        return E_LEC_SGCC_UNKNOWN;
                    }

                    p_sgcc_socket->it_rawmode_flag= LXZAT_TRUE;
                    p_sgcc_socket->it_socket_state = E_LESS_ESTABLISHED;
                    lxzat_task_rawmode_udpclient_newtask(i_id_socket);

                    p_cur_datacfg->fp_data_handler = lxzdata_dollar_rawmode_udphandler;
                    * ((sint32 *)p_cur_datacfg->p_param_ctxt) = i_id_socket;
                    p_cur_spcfg->i_jump_length = LXZAT_TRYWRITE_LEN_MAX;
                    p_cur_spcfg->pt_di_cfg = p_cur_datacfg;
                    p_cur_spcfg->i_echo_auxiliary = LXZAT_FALSE;
                    lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
                    lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
                        E_LSMA_FIXED_3PLUS, 0, 0);
                    break;
                }
            default:
                {
                    break;
                }
            }
            break;
        }
     case LXZAT_REQ_TYPE_READ:
         {
             break;
         }
     case LXZAT_REQ_TYPE_TEST:
         {
             break;
    }

    default:
        {
            break;
        }
   }
    return  i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETCREATE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetcreate_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetcreate_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetcreate_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            if(PARAM2(p_cur_req).it_number == LXZAT_NET_TYPE_TCPS)
            {
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N1,  "OK");
                i_err_code = E_LEC_OK_NOTHING;
                break;
            }
            else
            {
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N1,  "CONNECT");
                i_err_code = E_LEC_OK_NOTHING;
                break;
            }

        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <ChannelID>,<Lay3Type>,<SocketID>,<\"url/ip\">,<rport>[,lport]",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }

    default:
        {
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYNETCREATE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetcreate_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYFTPOPEN".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpopen_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYFTPOPEN".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpopen_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_flag_isactive = 0;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myftpopen_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myftpopen_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            sint32 i_len_string = 0;
            uint16 i_port_ftpcmd = 0;

            sint32 i_id_channel = 0;
            sint32 i_ftp_mode = 0;
            sint32 i_timeout = 0;
            sint32 i_ftp_type = 0;
            uint08 p_dns_peer [LXZAT_FTP_DNS_MAX_LEN];
            uint08 p_username [LXZAT_FTP_USR_MAX_LEN];
            uint08 p_password [LXZAT_FTP_PWD_MAX_LEN];

            lxz_easyftp_t* p_eftp_ctxt = gsp_eftp_context;
            
            if (p_eftp_ctxt != NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,p_eftp_ctxt=0x%08X\r\n", p_eftp_ctxt));
                return E_LEC_SGCC_SOCKET_CONNECT;
            }
            
            if (p_cur_req->it_nb_param != 7)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            
            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,param1 type error!\r\n"));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            
            if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,param2 type error!\r\n"));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            
            if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,param3 type error!\r\n"));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            
            if (PARAM4_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,param4 type error!\r\n"));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            
            if (PARAM5_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,param5 type error!\r\n"));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            
            if (PARAM6_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,param6 type error!\r\n"));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            
            if (PARAM7_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,param7 type error!\r\n"));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            
            i_id_channel = PARAM1(p_cur_req).it_number;
            if(i_id_channel < LXZAT_CHANNEL_ID_MIN || i_id_channel > LXZAT_CHANNEL_ID_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,i_id_channel=%d\r\n",i_id_channel));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            i_flag_isactive = lxzat_sgcc_ifconfig_f_get(i_id_channel, NULL);
            if (i_flag_isactive == LXZAT_FALSE)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,lxzat_sgcc_ifconfig_f_get,i_flag_isactive:%d\r\n",i_flag_isactive));
                return E_LEC_SGCC_PDP_NO_ACTIVED;
            }
            
            i_len_string = PARAM2(p_cur_req).pt_str->it_length;
            if (i_len_string > LXZAT_FTP_DNS_MAX_LEN)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,i_len_string(param2)=%d\r\n",i_len_string));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            i_len_string = PARAM3(p_cur_req).pt_str->it_length;
            if (i_len_string > LXZAT_FTP_USR_MAX_LEN)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,i_len_string(param3)=%d\r\n",i_len_string));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            i_len_string = PARAM4(p_cur_req).pt_str->it_length;
            if (i_len_string > LXZAT_FTP_PWD_MAX_LEN)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,i_len_string(param4)=%d\r\n",i_len_string));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            memset(p_dns_peer, 0, LXZAT_FTP_DNS_MAX_LEN);
            lxz_dstring_get(PARAM2(p_cur_req).pt_str, p_dns_peer, LXZAT_FTP_DNS_MAX_LEN);
            memset(p_username, 0, LXZAT_FTP_USR_MAX_LEN);
            lxz_dstring_get(PARAM3(p_cur_req).pt_str, p_username, LXZAT_FTP_USR_MAX_LEN);
            memset(p_password, 0, LXZAT_FTP_PWD_MAX_LEN);
            lxz_dstring_get(PARAM4(p_cur_req).pt_str, p_password, LXZAT_FTP_PWD_MAX_LEN);
            
            i_ftp_mode = PARAM5(p_cur_req).it_number;
            if (i_ftp_mode != 0 && i_ftp_mode != 1) {
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            i_timeout = PARAM6(p_cur_req).it_number;
            if (i_timeout < 5 || i_timeout > 180) {
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            i_ftp_type = PARAM7(p_cur_req).it_number;
            if (i_ftp_type != 0 && i_ftp_type != 1) {
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            
            i_port_ftpcmd = 21;/* default port */
            if(!isalpha(p_dns_peer[0])) {
                char *temp = strchr(p_dns_peer, ':');
                if (temp != NULL){
                    *temp++='\0';
                    i_port_ftpcmd = atoi(temp);
                }
            }
            
            p_eftp_ctxt = eftp_ftpsession_f_open(p_dns_peer, i_port_ftpcmd,
                p_username, p_password, i_ftp_mode, i_timeout, i_ftp_type);
            if (p_eftp_ctxt == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpopen_req,eftp_ftpsession_f_open,p_eftp_ctxt==NULL\r\n"));
                return E_LEC_SGCC_TCP_CONNECT_TIMEOUT;
            }
            p_eftp_ctxt->channel_id = i_id_channel;
            p_eftp_ctxt->it_state_cmdsocket = E_EFSS_CONNECT;
            gsp_eftp_context = p_eftp_ctxt;

            lxzat_task_ftpcmd_newtask(p_lxzat_ctxt->it_vsp_id);

            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: 1",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            
            break;
        }

    default:
        {
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYFTPOPEN".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpopen_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_flag_isactive = 0;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myftpopen_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myftpopen_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            sint32 i_flag_ftpstatus = 0;

            i_flag_ftpstatus = ((gsp_eftp_context == NULL)?0:1);
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %d",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword, i_flag_ftpstatus);
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N1,
                "%s: <ChannelID>,<\"ip/url[:port]\">,<\"usr\">,<\"pwd\">,<mode>,<timeout>,<type>",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }

    default:
        {
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYFTPOPEN".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpopen_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYFTPCLOSE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpclose_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYFTPCLOSE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpclose_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mystringget_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mystringget_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_EXE:
        {
            lxz_easyftp_t* p_eftp_ctxt = gsp_eftp_context;
            if (p_eftp_ctxt == NULL)
            {
                return E_LEC_OK;
            }

            eftp_ftpsession_f_close(p_eftp_ctxt);
            gsp_eftp_context = NULL;
        break;
        }
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }

    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYFTPCLOSE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpclose_resp(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The reset handler of "AT$MYFTPCLOSE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpclose_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYFTPSIZE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpsize_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYFTPSIZE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpsize_req(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The response handler of "AT$MYFTPSIZE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpsize_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_get_fileSize = 0;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myftpsize_resp,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myftpsize_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            sint32  i_len_string = 0;
            lxz_easyftp_t* p_eftp_ctxt = NULL;

            p_eftp_ctxt = gsp_eftp_context;
            if (p_eftp_ctxt == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpsize_resp,p_eftp_ctxt is NULL\r\n"));
                return E_LEC_SGCC_ERROR;
            }

            if (p_cur_req->it_nb_param != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpsize_resp,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpsize_resp,param1 type is error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_len_string = PARAM1(p_cur_req).pt_str->it_length;
            if ((i_len_string < 0) || (i_len_string > EFTP_MAX_LEN_FILENAME))
            {
                OS_DBG_LOG(("lxzat_dollar_myftpsize_resp,i_len_string=%d!\r\n", i_len_string));
                return E_LEC_ERR_P_RANGE;
            }
            
            lxz_dstring_get(PARAM1(p_cur_req).pt_str, p_eftp_ctxt->get_filename, EFTP_MAX_LEN_FILENAME);
            p_eftp_ctxt->it_flag_fsize = 0;
            eftp_ftpdata_f_close(p_eftp_ctxt);
            i_get_fileSize = eftp_ftpsession_f_fSize(p_eftp_ctxt);
            if (i_get_fileSize < 0)
            {
                eftp_ftpdata_f_close(p_eftp_ctxt);
                return E_LEC_SGCC_ERROR;
            }

            p_eftp_ctxt->it_flag_fsize = 1;
            p_eftp_ctxt->it_read_fsize = i_get_fileSize;
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %d",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                i_get_fileSize);
        break;
        }
    case LXZAT_REQ_TYPE_READ:
    {
        break;
    }

    case LXZAT_REQ_TYPE_TEST:
    {
        lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <Filename>",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
        break;
    }

    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYFTPSIZE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpsize_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYFTPGET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpget_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYFTPGET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpget_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myftpget_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myftpget_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
        sint32 i_len_string = 0;
        char filename[256] = {0};

        sint32 i_len_curread = 0;
        sint32 i_len_allread = 0;
        sint32 i_len_tryread = 0;
        sint32 i_pos_tryread = 0;
        sint32 i_len_freespace = 0;
        lxz_easyftp_t* p_eftp_ctxt = gsp_eftp_context;

        if (p_eftp_ctxt == NULL)
        {
            OS_DBG_LOG(("lxzat_dollar_myftpget_req,p_eftp_ctxt is NULL\r\n"));
            return E_LEC_SGCC_ERROR;
        } 

        switch(p_cur_req->it_nb_param)
        {
        case 1:
            OS_DBG_LOG(("lxzat_dollar_myftpget_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpget_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_len_string = PARAM1(p_cur_req).pt_str->it_length;
            if ((i_len_string <= 0) || (i_len_string > EFTP_MAX_LEN_FILENAME))
            {
                OS_DBG_LOG(("lxzat_dollar_myftpget_req,i_len_string=%d\r\n",i_len_string));
                return E_LEC_ERR_P_LENGTH;
            }

            lxz_dstring_get(PARAM1(p_cur_req).pt_str, filename, sizeof(filename));
            if (strcmp(p_eftp_ctxt->get_filename,filename) != 0)
            {
                p_eftp_ctxt->it_flag_fsize = 0;
                strcpy(p_eftp_ctxt->get_filename, filename);
                eftp_ftpdata_f_close(p_eftp_ctxt);
                p_eftp_ctxt->it_read_fsize = eftp_ftpsession_f_fSize(p_eftp_ctxt);
                if (p_eftp_ctxt->it_read_fsize < 0)
                {
                    OS_DBG_LOG(("lxzat_dollar_myftpget_req,i_file_size get-failure\r\n"));
                    return E_LEC_SGCC_UNKNOWN;
                }

                p_eftp_ctxt->it_flag_fsize = 1;
                memset(p_eftp_ctxt->get_filename, 0x00, EFTP_MAX_LEN_FILENAME);
                memcpy(p_eftp_ctxt->get_filename, filename, strlen(filename));
            }

            p_eftp_ctxt->i_pos_tryread = 0;
            p_eftp_ctxt->i_len_tryread = p_eftp_ctxt->it_read_fsize;

            i_err_code = eftp_ftpdata_f_ftpget(p_eftp_ctxt, filename, 0);
            if (i_err_code <= 0)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpget_req,eftp_ftpdata_f_ftpget,i_err_code=%d\r\n", i_err_code));
                eftp_ftpdata_f_close(p_eftp_ctxt);
                return E_LEC_SGCC_UNKNOWN;
            }
            lxzat_task_ftpdata_newtask(p_lxzat_ctxt->it_vsp_id);



            i_pos_tryread = p_eftp_ctxt->i_pos_tryread;
            i_len_tryread = p_eftp_ctxt->i_len_tryread;
            i_len_curread = 0;
            i_len_curread = 0;
            while (i_len_allread < i_len_tryread)
            {
                i_len_tryread = p_eftp_ctxt->i_len_tryread - i_len_allread;
                if (osp_socket_f_getavailable(p_eftp_ctxt->it_data_socket) > 0)
                {
                    i_len_curread = osp_socket_f_read(p_eftp_ctxt->it_data_socket, 
                        p_eftp_ctxt->pt_buf_data, i_len_tryread);
                    i_len_allread = i_len_allread + i_len_curread;
                }

                osp_timer_f_sleep(1);
            }

            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N1,
                "%s",
                "CONNECT");
            lxzat_rsp_f_printfbin(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P0N0,
                p_eftp_ctxt->pt_buf_data,
                i_len_curread);
            i_err_code = E_LEC_OK;
            break;

        case 3:
            OS_DBG_LOG(("lxzat_dollar_myftpget_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpget_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpget_req,param2 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpget_req,param3 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_len_string = PARAM1(p_cur_req).pt_str->it_length;
            if ((i_len_string <= 0) || (i_len_string > EFTP_MAX_LEN_FILENAME))
            {
                OS_DBG_LOG(("lxzat_dollar_myftpget_req,param1,i_len_string=%d\r\n",i_len_string));
                return E_LEC_ERR_P_LENGTH;
            }

            lxz_dstring_get(PARAM1(p_cur_req).pt_str, filename, sizeof(filename));
            if (strcmp(p_eftp_ctxt->get_filename,filename) != 0)
            {
                p_eftp_ctxt->it_flag_fsize = 0;
                strcpy(p_eftp_ctxt->get_filename, filename);
                eftp_ftpdata_f_close(p_eftp_ctxt);
                p_eftp_ctxt->it_read_fsize = eftp_ftpsession_f_fSize(p_eftp_ctxt);
                if (p_eftp_ctxt->it_read_fsize < 0)
                {
                    OS_DBG_LOG(("lxzat_dollar_myftpget_req,i_file_size get-failure\r\n"));
                    eftp_ftpdata_f_close(p_eftp_ctxt);
                    return E_LEC_SGCC_UNKNOWN;
                }

                p_eftp_ctxt->it_flag_fsize = 1;
                memset(p_eftp_ctxt->get_filename, 0x00, EFTP_MAX_LEN_FILENAME);
                memcpy(p_eftp_ctxt->get_filename, filename, strlen(filename));
            }

            OS_DBG_LOG(("lxzat_dollar_myftpget_req,i_file_size=%d\r\n", p_eftp_ctxt->it_read_fsize));

            i_pos_tryread = PARAM2(p_cur_req).it_number;
            if (   (i_pos_tryread < 0)
                || (i_pos_tryread >= p_eftp_ctxt->it_read_fsize))
            {
                OS_DBG_LOG(("lxzat_dollar_myftpget_req,param2,i_pos_tryread=%d\r\n",i_pos_tryread));
                return E_LEC_ERR_P_RANGE;
            }

            i_len_tryread = PARAM3(p_cur_req).it_number;
            if (   (i_len_tryread < 0)
                || (i_len_tryread > p_eftp_ctxt->it_read_fsize))
            {
                OS_DBG_LOG(("lxzat_dollar_myftpget_req,param3,i_len_tryread=%d\r\n",i_len_tryread));
                return E_LEC_ERR_P_RANGE;
            }
            if ((i_pos_tryread + i_len_tryread) > p_eftp_ctxt->it_read_fsize)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpget_req,param3,i_len_tryread=%d,warning\r\n",i_len_tryread));
                i_len_tryread = p_eftp_ctxt->it_read_fsize - i_pos_tryread;
                OS_DBG_LOG(("lxzat_dollar_myftpget_req,param3,i_len_tryread=%d,changed\r\n",i_len_tryread));
            }
            OS_DBG_LOG(("lxzat_dollar_myftpget_req,param3,i_len_tryread=%d\r\n",i_len_tryread));
            
            if (   (i_pos_tryread == p_eftp_ctxt->i_pos_tryread)
                && (i_len_tryread == p_eftp_ctxt->i_len_tryread))
            {
                if (p_eftp_ctxt->it_state_datasocket != E_EFSS_IDLE)
                {
                    OS_DBG_LOG(("lxzat_dollar_myftpget_req,reread last-packet!\r\n"));
                    i_err_code = E_LEC_OK;
                    lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P1N1,
                        "%s",
                        "CONNECT");
                    lxzat_rsp_f_printfbin(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P0N0,
                        p_eftp_ctxt->pt_buf_data,
                        i_len_tryread);
                    return i_err_code;
                }
            }

            if (i_pos_tryread != (p_eftp_ctxt->i_pos_tryread + p_eftp_ctxt->i_len_tryread))
            {
                if (p_eftp_ctxt->it_state_datasocket != E_EFSS_IDLE)
                {
                    /* !!!discontinuous read!!! */
                    eftp_ftpdata_f_close(p_eftp_ctxt);
                    OS_DBG_LOG(("lxzat_dollar_myftpget_req:abnormal:discontinuous read occurred!\r\n"));
                }
            }

            if (p_eftp_ctxt->it_state_datasocket == E_EFSS_IDLE)
            {
                i_err_code = eftp_ftpdata_f_ftpget(p_eftp_ctxt, filename, i_pos_tryread);
                if (i_err_code <= 0)
                {
                    OS_DBG_LOG(("lxzat_dollar_myftpget_req,eftp_ftpdata_f_ftpget,i_err_code=%d\r\n", i_err_code));
                    eftp_ftpdata_f_close(p_eftp_ctxt);
                    return E_LEC_SGCC_UNKNOWN;
                }
                p_eftp_ctxt->it_state_datasocket = E_EFSS_CONNECT;
                lxzat_task_ftpdata_newtask(p_lxzat_ctxt->it_vsp_id);
            }

            p_eftp_ctxt->i_pos_tryread = i_pos_tryread;
            p_eftp_ctxt->i_len_tryread = i_len_tryread;

            i_err_code = E_LEC_OK;
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N1,
                "%s",
                "CONNECT");
            
            i_len_curread = 0;
            i_len_curread = 0;
            while (i_len_allread < i_len_tryread)
            {
                if (osp_socket_f_getavailable(p_eftp_ctxt->it_data_socket) > 0)
                {
                    i_len_freespace = i_len_tryread - i_len_allread;
                    
                    i_len_curread = osp_socket_f_read(p_eftp_ctxt->it_data_socket, 
                        &(p_eftp_ctxt->pt_buf_data[i_len_allread]), i_len_freespace);
                    if (i_len_curread == 0)
                    {
                        osp_timer_f_sleep(1);
                    }
                    else if (i_len_curread < 0)
                    {
                        OS_DBG_LOG(("lxzat_dollar_myftpget_req,osp_socket_f_read,i_len_curread=%d\r\n", i_len_curread));
                        eftp_ftpdata_f_close(p_eftp_ctxt);
                        i_err_code = E_LEC_SGCC_UNKNOWN;
                        break;
                    }
                    else
                    {
                        i_len_allread = i_len_allread + i_len_curread;
                    }
                }
                
                osp_timer_f_sleep(1);
            }

            lxzat_rsp_f_printfbin(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P0N0,
                        p_eftp_ctxt->pt_buf_data,
                        i_len_allread);
            break;

        default:
            OS_DBG_LOG(("lxzat_dollar_myftpget_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
            return E_LEC_ERR_P_NB_PARAM;
            break;
        }

        break;
    }

    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
        
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <\"Filename\">[,<iPosTryread>,<iLenTryread>]",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYFTPGET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpget_resp(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The reset handler of "AT$MYFTPGET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpget_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYFTPPUT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpput_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYFTPPUT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpput_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myftpput_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myftpput_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            lxz_easyftp_t* p_eftp_ctxt = gsp_eftp_context;

            sint32 i_len_trywrite = 0;
            sint32 i_eof_trywrite = 0;
            
            if (p_eftp_ctxt == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpput_req,p_eftp_ctxt is NULL\r\n"));
                return E_LEC_SGCC_ERROR;
            } 
            
            if (p_cur_req->it_nb_param != 3)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpput_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }
            
            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpput_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }
            
            if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpput_req,param2 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }
            
            if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpput_req,param3 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_len_trywrite = PARAM2(p_cur_req).it_number;
            if(i_len_trywrite < LXZAT_FTP_TRYWRITE_LEN_MIN || i_len_trywrite > LXZAT_FTP_TRYWRITE_LEN_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpput_req,i_len_trywrite=%d\r\n",i_len_trywrite));
                return E_LEC_ERR_UNSUPPORTED;
            }
            
            i_eof_trywrite = PARAM3(p_cur_req).it_number;
            if(i_eof_trywrite != 0 && i_eof_trywrite != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpput_req,i_eof_trywrite=%d\r\n",i_eof_trywrite));
                return E_LEC_ERR_UNSUPPORTED;
            }

            p_cur_datacfg = (lxzdata_info_t *)malloc(sizeof(lxzdata_info_t));
            if (p_cur_datacfg == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_myftpput_req,p_cur_datacfg==NULL\r\n"));
                return E_LEC_ERR_MEM_MALLOC;
            }

            memset(p_cur_datacfg, 0, sizeof(lxzdata_info_t));

            p_eftp_ctxt->i_eof_trywrite = i_eof_trywrite;
            p_eftp_ctxt->i_len_trywrite = i_len_trywrite;
            memset(p_eftp_ctxt->put_filename, 0x00, EFTP_MAX_LEN_FILENAME);
            lxz_dstring_get(PARAM1(p_cur_req).pt_str, p_eftp_ctxt->put_filename, EFTP_MAX_LEN_FILENAME);
            
            if (p_eftp_ctxt->it_state_datasocket == E_EFSS_IDLE)
            {
                i_err_code = eftp_ftpdata_f_ftpput(p_eftp_ctxt, p_eftp_ctxt->put_filename);
                if (i_err_code <= 0)
                {
                    free(p_cur_datacfg);
                    p_cur_datacfg = NULL;

                    OS_DBG_LOG(("lxzat_dollar_myftpput_req,eftp_ftpdata_f_ftpput,i_err_code=%d\r\n", i_err_code));
                    return E_LEC_SGCC_UNKNOWN;
                }
                p_eftp_ctxt->it_state_datasocket = E_EFSS_CONNECT;
                lxzat_task_ftpdata_newtask(p_lxzat_ctxt->it_vsp_id);
            }

            p_cur_datacfg->p_param_ctxt = NULL;
            p_cur_datacfg->fp_data_handler = lxzdata_dollar_myftpput_handler;
            p_cur_spcfg->pt_di_cfg = p_cur_datacfg;
            
            lxzat_spcomm_f_clear(p_cur_spcfg->i_vsp_id);
            lxzat_spcomm_f_ChangeWorkMode(p_cur_spcfg->i_vsp_id,
                E_LSMA_LEN_3PLUS, 0, 0);
            
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N1,
                "%s","CONNECT");
            i_err_code = E_LEC_OK_NOTHING;
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }


    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYFTPPUT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpput_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myftpput_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myftpput_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            i_err_code = E_LEC_OK_NOTHING;
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <\"Filename\">,<iLengthTryPut>,<iEOF>",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYFTPPUT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myftpput_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYBCCH".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mybcch_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYBCCH".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mybcch_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mybcch_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mybcch_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            sint32  i_new_action = 0;

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mybcch_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_new_action = PARAM1(p_cur_req).it_number;
            if ((i_new_action < 0) || (i_new_action > 2))
            {
                OS_DBG_LOG(("lxzat_dollar_mybcch_req,i_new_action=%d!\r\n", i_new_action));
                return E_LEC_ERR_P_RANGE;
            }

            if (i_new_action == 0)
            {
                gs_lock_gsmbcch = 0;
            }
            else if (i_new_action == 1)
            {
                sint32 i = 0;
                sint32 i_nb_trylock = 0;

                sint32 i_nb_listed = 0;
                lxzat_mybcch_t * p_list_gsmbcch = NULL;
                lxzat_mybcch_t * p_lock_gsmbcch = NULL;

                if (gs_lock_gsmband != 0)
                {
                    OS_DBG_LOG(("lxzat_dollar_mybcch_req,gs_lock_gsmband=%d!\r\n", gs_lock_gsmband));
                    return E_LEC_SGCC_ERROR;
                }

                i_nb_listed = (sizeof(gs_list_gsmbcch_table)/sizeof(gs_list_gsmbcch_table[0]));
                switch (p_cur_req->it_nb_param)
                {
                case 1:
                    {
                        i = 0;
                        p_list_gsmbcch = &(gs_list_gsmbcch_table[i]);
                        p_lock_gsmbcch = &(gs_lock_gsmbcch_table[i]);
                        p_lock_gsmbcch->ut_bcch_id = p_list_gsmbcch->ut_bcch_id;
                        p_lock_gsmbcch->ut_mcc_id= p_list_gsmbcch->ut_mcc_id;
                        p_lock_gsmbcch->ut_mnc_id = p_list_gsmbcch->ut_mnc_id;
                        p_lock_gsmbcch->ut_lac_id = p_list_gsmbcch->ut_lac_id;
                        p_lock_gsmbcch->ut_cell_id = p_list_gsmbcch->ut_cell_id;

                        gs_lock_gsmbcch = 1;
                        break;
                    }
                case 2:
                    {
                        sint32 i_is_matched = 0;
                        sint32 i_1st_match_id = 0;

                        uint16 i_1st_bcch_id = 0;

                        if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                        {
                            OS_DBG_LOG(("lxzat_dollar_mybcch_req,param2 type error!\r\n"));
                            return E_LEC_ERR_P_TYPE;
                        }

                        i_1st_bcch_id = (uint16)(PARAM2(p_cur_req).it_number);

                        /* 1st, will be locked BCCH */
                        i = 0;
                        i_is_matched = 0;
                        while (i < i_nb_listed)
                        {
                            p_list_gsmbcch = &(gs_list_gsmbcch_table[i]);
                            if (p_list_gsmbcch->ut_bcch_id == i_1st_bcch_id)
                            {
                                i_1st_match_id = i;
                                i_is_matched = 1;
                                break;
                            }

                            i++;
                        }

                        if (i_is_matched != 1)
                        {
                            return E_LEC_ERR_NOT_ALLOWED;
                        }

                        p_list_gsmbcch = &(gs_list_gsmbcch_table[i_1st_match_id]);
                        p_lock_gsmbcch = &(gs_lock_gsmbcch_table[0]);
                        p_lock_gsmbcch->ut_bcch_id = p_list_gsmbcch->ut_bcch_id;
                        p_lock_gsmbcch->ut_mcc_id= p_list_gsmbcch->ut_mcc_id;
                        p_lock_gsmbcch->ut_mnc_id = p_list_gsmbcch->ut_mnc_id;
                        p_lock_gsmbcch->ut_lac_id = p_list_gsmbcch->ut_lac_id;
                        p_lock_gsmbcch->ut_cell_id = p_list_gsmbcch->ut_cell_id;

                        gs_lock_gsmbcch = 1;
                        break;
                    }
                case 3:
                    {
                        sint32 i_is_matched = 0;
                        sint32 i_1st_match_id = 0;
                        sint32 i_2nd_match_id = 0;

                        uint16 i_1st_bcch_id = 0;
                        uint16 i_2nd_bcch_id = 0;

                        if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                        {
                            OS_DBG_LOG(("lxzat_dollar_mybcch_req,param2 type error!\r\n"));
                            return E_LEC_ERR_P_TYPE;
                        }

                        if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                        {
                            OS_DBG_LOG(("lxzat_dollar_mybcch_req,param3 type error!\r\n"));
                            return E_LEC_ERR_P_TYPE;
                        }

                        i_1st_bcch_id = (uint16)(PARAM2(p_cur_req).it_number);
                        i_2nd_bcch_id = (uint16)(PARAM3(p_cur_req).it_number);
                        if (i_1st_bcch_id == i_2nd_bcch_id)
                        {
                            OS_DBG_LOG(("lxzat_dollar_mybcch_req,i_1st_bcch_id == i_2nd_bcch_id!\r\n"));
                            return E_LEC_ERR_NOT_ALLOWED;
                        }

                        /* 1st, will be locked BCCH */
                        i = 0;
                        i_is_matched = 0;
                        while (i < i_nb_listed)
                        {
                            p_list_gsmbcch = &(gs_list_gsmbcch_table[i]);
                            if (p_list_gsmbcch->ut_bcch_id == i_1st_bcch_id)
                            {
                                i_1st_match_id = i;
                                i_is_matched = 1;
                                break;
                            }

                            i++;
                        }

                        if (i_is_matched != 1)
                        {
                            return E_LEC_ERR_NOT_ALLOWED;
                        }

                        /* 2nd, will be locked BCCH */
                        i = 0;
                        i_is_matched = 0;
                        while (i < i_nb_listed)
                        {
                            p_list_gsmbcch = &(gs_list_gsmbcch_table[i]);
                            if (p_list_gsmbcch->ut_bcch_id == i_2nd_bcch_id)
                            {
                                i_2nd_match_id = i;
                                i_is_matched = 1;
                                break;
                            }

                            i++;
                        }

                        if (i_is_matched != 1)
                        {
                            return E_LEC_ERR_NOT_ALLOWED;
                        }

                        p_list_gsmbcch = &(gs_list_gsmbcch_table[i_1st_match_id]);
                        p_lock_gsmbcch = &(gs_lock_gsmbcch_table[0]);
                        p_lock_gsmbcch->ut_bcch_id = p_list_gsmbcch->ut_bcch_id;
                        p_lock_gsmbcch->ut_mcc_id= p_list_gsmbcch->ut_mcc_id;
                        p_lock_gsmbcch->ut_mnc_id = p_list_gsmbcch->ut_mnc_id;
                        p_lock_gsmbcch->ut_lac_id = p_list_gsmbcch->ut_lac_id;
                        p_lock_gsmbcch->ut_cell_id = p_list_gsmbcch->ut_cell_id;

                        p_list_gsmbcch = &(gs_list_gsmbcch_table[i_2nd_match_id]);
                        p_lock_gsmbcch = &(gs_lock_gsmbcch_table[1]);
                        p_lock_gsmbcch->ut_bcch_id = p_list_gsmbcch->ut_bcch_id;
                        p_lock_gsmbcch->ut_mcc_id= p_list_gsmbcch->ut_mcc_id;
                        p_lock_gsmbcch->ut_mnc_id = p_list_gsmbcch->ut_mnc_id;
                        p_lock_gsmbcch->ut_lac_id = p_list_gsmbcch->ut_lac_id;
                        p_lock_gsmbcch->ut_cell_id = p_list_gsmbcch->ut_cell_id;

                        gs_lock_gsmbcch = 2;
                        break;
                    }
                case 4:
                    {
                        sint32 i_is_matched = 0;
                        sint32 i_1st_match_id = 0;
                        sint32 i_2nd_match_id = 0;
                        sint32 i_3rd_match_id = 0;

                        uint16 i_1st_bcch_id = 0;
                        uint16 i_2nd_bcch_id = 0;
                        uint16 i_3rd_bcch_id = 0;

                        if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                        {
                            OS_DBG_LOG(("lxzat_dollar_mybcch_req,param2 type error!\r\n"));
                            return E_LEC_ERR_P_TYPE;
                        }

                        if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                        {
                            OS_DBG_LOG(("lxzat_dollar_mybcch_req,param3 type error!\r\n"));
                            return E_LEC_ERR_P_TYPE;
                        }
                        
                        if (PARAM4_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                        {
                            OS_DBG_LOG(("lxzat_dollar_mybcch_req,param4 type error!\r\n"));
                            return E_LEC_ERR_P_TYPE;
                        }

                        i_1st_bcch_id = (uint16)(PARAM2(p_cur_req).it_number);
                        i_2nd_bcch_id = (uint16)(PARAM3(p_cur_req).it_number);
                        i_3rd_bcch_id = (uint16)(PARAM4(p_cur_req).it_number);
                        if (i_1st_bcch_id == i_2nd_bcch_id)
                        {
                            OS_DBG_LOG(("lxzat_dollar_mybcch_req,i_1st_bcch_id == i_2nd_bcch_id!\r\n"));
                            return E_LEC_ERR_NOT_ALLOWED;
                        }
                        if (i_1st_bcch_id == i_3rd_bcch_id)
                        {
                            OS_DBG_LOG(("lxzat_dollar_mybcch_req,i_1st_bcch_id == i_3rd_bcch_id!\r\n"));
                            return E_LEC_ERR_NOT_ALLOWED;
                        }
                        if (i_2nd_bcch_id == i_3rd_bcch_id)
                        {
                            OS_DBG_LOG(("lxzat_dollar_mybcch_req,i_2nd_bcch_id == i_3rd_bcch_id!\r\n"));
                            return E_LEC_ERR_NOT_ALLOWED;
                        }

                        /* 1st, will be locked BCCH */
                        i = 0;
                        i_is_matched = 0;
                        while (i < i_nb_listed)
                        {
                            p_list_gsmbcch = &(gs_list_gsmbcch_table[i]);
                            if (p_list_gsmbcch->ut_bcch_id == i_1st_bcch_id)
                            {
                                i_1st_match_id = i;
                                i_is_matched = 1;
                                break;
                            }

                            i++;
                        }

                        if (i_is_matched != 1)
                        {
                            return E_LEC_ERR_NOT_ALLOWED;
                        }

                        /* 2nd, will be locked BCCH */
                        i = 0;
                        i_is_matched = 0;
                        while (i < i_nb_listed)
                        {
                            p_list_gsmbcch = &(gs_list_gsmbcch_table[i]);
                            if (p_list_gsmbcch->ut_bcch_id == i_2nd_bcch_id)
                            {
                                i_2nd_match_id = i;
                                i_is_matched = 1;
                                break;
                            }

                            i++;
                        }

                        if (i_is_matched != 1)
                        {
                            return E_LEC_ERR_NOT_ALLOWED;
                        }

                        /* 3rd, will be locked BCCH */
                        i = 0;
                        i_is_matched = 0;
                        while (i < i_nb_listed)
                        {
                            p_list_gsmbcch = &(gs_list_gsmbcch_table[i]);
                            if (p_list_gsmbcch->ut_bcch_id == i_3rd_bcch_id)
                            {
                                i_3rd_match_id = i;
                                i_is_matched = 1;
                                break;
                            }

                            i++;
                        }

                        if (i_is_matched != 1)
                        {
                            return E_LEC_ERR_NOT_ALLOWED;
                        }

                        p_list_gsmbcch = &(gs_list_gsmbcch_table[i_1st_match_id]);
                        p_lock_gsmbcch = &(gs_lock_gsmbcch_table[0]);
                        p_lock_gsmbcch->ut_bcch_id = p_list_gsmbcch->ut_bcch_id;
                        p_lock_gsmbcch->ut_mcc_id= p_list_gsmbcch->ut_mcc_id;
                        p_lock_gsmbcch->ut_mnc_id = p_list_gsmbcch->ut_mnc_id;
                        p_lock_gsmbcch->ut_lac_id = p_list_gsmbcch->ut_lac_id;
                        p_lock_gsmbcch->ut_cell_id = p_list_gsmbcch->ut_cell_id;

                        p_list_gsmbcch = &(gs_list_gsmbcch_table[i_2nd_match_id]);
                        p_lock_gsmbcch = &(gs_lock_gsmbcch_table[1]);
                        p_lock_gsmbcch->ut_bcch_id = p_list_gsmbcch->ut_bcch_id;
                        p_lock_gsmbcch->ut_mcc_id= p_list_gsmbcch->ut_mcc_id;
                        p_lock_gsmbcch->ut_mnc_id = p_list_gsmbcch->ut_mnc_id;
                        p_lock_gsmbcch->ut_lac_id = p_list_gsmbcch->ut_lac_id;
                        p_lock_gsmbcch->ut_cell_id = p_list_gsmbcch->ut_cell_id;

                        p_list_gsmbcch = &(gs_list_gsmbcch_table[i_3rd_match_id]);
                        p_lock_gsmbcch = &(gs_lock_gsmbcch_table[2]);
                        p_lock_gsmbcch->ut_bcch_id = p_list_gsmbcch->ut_bcch_id;
                        p_lock_gsmbcch->ut_mcc_id= p_list_gsmbcch->ut_mcc_id;
                        p_lock_gsmbcch->ut_mnc_id = p_list_gsmbcch->ut_mnc_id;
                        p_lock_gsmbcch->ut_lac_id = p_list_gsmbcch->ut_lac_id;
                        p_lock_gsmbcch->ut_cell_id = p_list_gsmbcch->ut_cell_id;

                        gs_lock_gsmbcch = 3;
                        break;
                    }
                default:
                    {
                        i_err_code = E_LEC_ERR_NOT_ALLOWED;
                        break;
                    }
                }
            }
            else
            {
                sint32 i = 0;
                sint32 i_nb_listed = 0;
                lxzat_mybcch_t * p_list_gsmbcch = NULL;

                i = 0;
                i_nb_listed = (sizeof(gs_list_gsmbcch_table)/sizeof(gs_list_gsmbcch_table[0]));
                while (i < i_nb_listed)
                {
                    p_list_gsmbcch = &(gs_list_gsmbcch_table[i]);
                    lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P1N0,
                        "%s: %d,%d,%02d,%X,%X",
                        p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                        p_list_gsmbcch->ut_bcch_id,
                        p_list_gsmbcch->ut_mcc_id,
                        p_list_gsmbcch->ut_mnc_id,
                        p_list_gsmbcch->ut_lac_id,
                        p_list_gsmbcch->ut_cell_id);

                    i++;
                }
            }
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYBCCH".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mybcch_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mybcch_resp,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mybcch_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            sint32 i = 0;
            sint32 i_nb_locked = 0;
            lxzat_mybcch_t * p_cur_mybcch = NULL;

            i_nb_locked = gs_lock_gsmbcch;
            if (i_nb_locked > 0)
            {
                while (i < i_nb_locked)
                {
                    p_cur_mybcch = &(gs_lock_gsmbcch_table[i]);
                    lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P1N0,
                        "%s: %d,%d,%02d,%X,%X",
                        p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                        p_cur_mybcch->ut_bcch_id,
                        p_cur_mybcch->ut_mcc_id,
                        p_cur_mybcch->ut_mnc_id,
                        p_cur_mybcch->ut_lac_id,
                        p_cur_mybcch->ut_cell_id);
                
                    i++;
                }
            }
            else
            {
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: UNLOCKED",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            }
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: (0,1,2),115,113,111",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYBCCH".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mybcch_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYBAND".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myband_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYBAND".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myband_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myband_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myband_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            sint32  i_new_gsmband = 0;

            if (p_cur_req->it_nb_param != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_myband_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_myband_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_new_gsmband = PARAM1(p_cur_req).it_number;
            if ((i_new_gsmband < 0) || (i_new_gsmband > 2))
            {
                OS_DBG_LOG(("lxzat_dollar_myband_req,i_new_gsmband=%d!\r\n", i_new_gsmband));
                return E_LEC_ERR_P_RANGE;
            }

            if (gs_lock_gsmbcch != 0)
            {
                OS_DBG_LOG(("lxzat_dollar_myband_req,gs_lock_gsmbcch=%d!\r\n", gs_lock_gsmbcch));
                return E_LEC_SGCC_ERROR;
            }

            gs_lock_gsmband = i_new_gsmband;
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYBAND".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myband_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myband_resp,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myband_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            sint32 i_cur_gsmband = 0;

            i_cur_gsmband = gs_lock_gsmband;
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %d",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                i_cur_gsmband);
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: (0-2)",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYBAND".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myband_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYGPSPOS".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mygpspos_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYGPSPOS".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mygpspos_req(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The response handler of "AT$MYGPSPOS".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mygpspos_resp(void * pctxt)
{
    return E_LEC_SGCC_UNKNOWN;
}

/*
 *  Description:
 *    The reset handler of "AT$MYGPSPOS".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mygpspos_reset(void * pctxt)
{
    return E_LEC_OK;
}

static sint32 lxzat_callback_tcpclient_f_exec(sint32 p1, sint32 p2)
{
    sint32 i_op_status = 0;

    sint32 i_nb_fds = 0;
    sint32 i_nb_bytes_available = 0;

    sint32 i_id_socket = 0;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    i_id_socket = p1;
    if ((i_id_socket < 0) || (i_id_socket > LXZAT_SGCC_NUM_MAX))
    {
        return i_op_status;
    }

    p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
    if (p_sgcc_socket == NULL)
    {
        OS_DBG_LOG(("lxzat_callback_tcpclient_f_exec,i_id_socket=%d,p_sgcc_socket==NULL\r\n", i_id_socket));
        return i_op_status;
    }

    p_cur_spcfg = lxzat_spcomm_f_get(p_sgcc_socket->it_vsp_id);
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzat_callback_tcpclient_f_exec,i_id_socket=%d,p_cur_spcfg==NULL\r\n", i_id_socket));
        return i_op_status;
    }

    if (p_sgcc_socket->it_socket_fd == 0)
    {
        OS_DBG_LOG(("lxzat_callback_tcpclient_f_exec,it_socket_fd=0x%08X\r\n", p_sgcc_socket->it_socket_fd));
        return i_op_status;
    }

    if (p_sgcc_socket->it_socket_state <= E_LESS_CONNECTING)
    {
        OS_DBG_LOG(("lxzat_callback_tcpclient_f_exec,it_socket_state=%d\r\n", p_sgcc_socket->it_socket_state));
        return i_op_status;
    }

    if (p_sgcc_socket->it_net_type != LXZAT_NET_TYPE_TCPC)
    {
        OS_DBG_LOG(("lxzat_callback_tcpclient_f_exec,it_net_type=%d\r\n", p_sgcc_socket->it_net_type));
        return i_op_status;
    }

    if (   (p_sgcc_socket->it_socket_state == E_LESS_ESTABLISHED)
        || (p_sgcc_socket->it_socket_state == E_LESS_SENDING))
    {
        i_nb_fds = osp_socket_f_select(p_sgcc_socket->it_socket_fd, OSP_EVENT_READ, 0);
        if (i_nb_fds > 0)
        {
            i_nb_bytes_available = osp_socket_f_getavailable(p_sgcc_socket->it_socket_fd);
            if (i_nb_bytes_available > 0)
            {
                if (p_sgcc_socket->it_urc_flag == 0)
                {
                    p_sgcc_socket->it_urc_flag = 1;
                    if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
                    {
                        lxzat_urc_f_printf(p_sgcc_socket->it_vsp_id, LXZAT_RSP_MODE_P1N1, "$MYURCREAD: %d", i_id_socket);
                    }
                }
            }
            else
            {
                p_sgcc_socket->it_socket_state = E_LESS_CLOSING;
                OS_DBG_LOG(("lxzat_callback_tcpclient_f_exec,i_id_socket=%d, closing!\r\n", i_id_socket));
            }
        }
    }

    if (p_sgcc_socket->it_socket_state == E_LESS_CLOSING)
    {
        i_nb_bytes_available = osp_socket_f_getavailable(p_sgcc_socket->it_socket_fd);
        if (i_nb_bytes_available <= 0)
        {
            if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
            {
                lxzat_urc_f_printf(p_sgcc_socket->it_vsp_id, LXZAT_RSP_MODE_P1N1, "$MYURCCLOSE: %d", i_id_socket);
            }
            lxzat_sgcc_socket_f_close(i_id_socket);
            OS_DBG_LOG(("lxzat_callback_tcpclient_f_exec,i_id_socket=%d, closed!\r\n", i_id_socket));
        }
    }

    i_op_status = 1;
    return i_op_status;
}

static sint32 lxzat_callback_tcpclient_f_exit(sint32 p1, sint32 p2)
{
    OS_DBG_LOG(("lxzat:lxzat_callback_tcpclient_f_exit\r\n"));
    return 1;
}

static sint32 lxzat_callback_udpclient_f_exec(sint32 p1, sint32 p2)
{
    sint32 i_op_status = 0;

    sint32 i_opt_size = 0;
    sint32 i_nb_bytes_available = 0;

    sint32 i_check_times = 0;
    sint32 i_id_socket = 0;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    i_id_socket = p1;
    if ((i_id_socket < 0) || (i_id_socket > LXZAT_SGCC_NUM_MAX))
    {
        return i_op_status;
    }

    p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
    if (p_sgcc_socket == NULL)
    {
        OS_DBG_LOG(("lxzat_callback_udpclient_f_exec,i_id_socket=%d,p_sgcc_socket==NULL\r\n", i_id_socket));
        return i_op_status;
    }

    p_cur_spcfg = lxzat_spcomm_f_get(p_sgcc_socket->it_vsp_id);
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzat_callback_udpclient_f_exec,i_id_socket=%d,p_cur_spcfg==NULL\r\n", i_id_socket));
        return i_op_status;
    }

    if (p_sgcc_socket->it_socket_fd == 0)
    {
        OS_DBG_LOG(("lxzat_callback_udpclient_f_exec,it_socket_fd=%d\r\n", p_sgcc_socket->it_socket_fd));
        return i_op_status;
    }
    
    if (p_sgcc_socket->it_socket_state <= E_LESS_CONNECTING)
    {
        OS_DBG_LOG(("lxzat_callback_udpclient_f_exec,it_socket_state=%d\r\n", p_sgcc_socket->it_socket_state));
        return i_op_status;
    }

    if (p_sgcc_socket->it_net_type != LXZAT_NET_TYPE_UDPC)
    {
        OS_DBG_LOG(("lxzat_callback_udpclient_f_exec,it_net_type=%d\r\n", p_sgcc_socket->it_net_type));
        return i_op_status;
    }

    i_nb_bytes_available = osp_socket_f_getavailable(p_sgcc_socket->it_socket_fd);
    if (i_nb_bytes_available)
    {
        if (p_sgcc_socket->it_urc_flag == 0)
        {
            p_sgcc_socket->it_urc_flag = 1;
            if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
            {
                lxzat_urc_f_printf(p_sgcc_socket->it_vsp_id, LXZAT_RSP_MODE_P1N1, "$MYURCREAD: %d", i_id_socket);
            }
        }
    }

    i_op_status = 1;
    return i_op_status;
}

static sint32 lxzat_callback_udpclient_f_exit(sint32 p1, sint32 p2)
{
    OS_DBG_LOG(("lxzat:lxzat_callback_udpclient_f_exit\r\n"));
    return 1;
}

static sint32 lxzat_callback_rawmode_tcpclient_f_exec(sint32 p1, sint32 p2)
{
    sint32 i_op_status = 0;

    sint32 i_nb_fds = 0;
    sint32 i_nb_bytes_read = 0;
    sint32 i_nb_bytes_available = 0;
    
    sint32 i_id_socket = 0;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;
    
    i_id_socket = p1;
    if ((i_id_socket < 0) || (i_id_socket > LXZAT_SGCC_NUM_MAX))
    {
        return i_op_status;
    }

    p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
    if (p_sgcc_socket == NULL)
    {
        OS_DBG_LOG(("lxzat_callback_rawmode_tcpclient_f_exec,i_id_socket=%d,p_sgcc_socket==NULL\r\n", i_id_socket));
        return i_op_status;
    }

    p_cur_spcfg = lxzat_spcomm_f_get(p_sgcc_socket->it_vsp_id);
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzat_callback_rawmode_tcpclient_f_exec,i_id_socket=%d,p_cur_spcfg==NULL\r\n", i_id_socket));
        return i_op_status;
    }
    
    if (p_sgcc_socket->it_socket_fd == 0)
    {
        OS_DBG_LOG(("lxzat_callback_rawmode_tcpclient_f_exec,it_socket_fd=%d\r\n", p_sgcc_socket->it_socket_fd));
        return i_op_status;
    }

    if (p_sgcc_socket->it_socket_state <= E_LESS_CONNECTING)
    {
        OS_DBG_LOG(("lxzat_callback_rawmode_tcpclient_f_exec,it_socket_state=%d\r\n", p_sgcc_socket->it_socket_state));
        return i_op_status;
    }

    if (p_sgcc_socket->it_net_type != LXZAT_NET_TYPE_TCPC)
    {
        OS_DBG_LOG(("lxzat_callback_rawmode_tcpclient_f_exec,it_net_type=%d\r\n", p_sgcc_socket->it_net_type));
        return i_op_status;
    }

    if (   (p_sgcc_socket->it_socket_state == E_LESS_ESTABLISHED)
        || (p_sgcc_socket->it_socket_state == E_LESS_SENDING))
    {
        sint32 i_nb_bytes_available = 0;
        i_nb_bytes_available = osp_socket_f_getavailable(p_sgcc_socket->it_socket_fd);
        if (i_nb_bytes_available > 0)
        {
            memset(p_sgcc_socket->pt_rxbuf,0,LXZAT_TRYREAD_LEN_MAX);
            i_nb_bytes_read = osp_socket_f_read(p_sgcc_socket->it_socket_fd,
                p_sgcc_socket->pt_rxbuf,LXZAT_TRYREAD_LEN_MAX);
            
            lxzat_spcomm_f_writebyid(p_sgcc_socket->it_vsp_id,
                p_sgcc_socket->pt_rxbuf, i_nb_bytes_read);
            lxzat_spcomm_f_flush(p_sgcc_socket->it_vsp_id);
        }

        i_nb_fds = osp_socket_f_select(p_sgcc_socket->it_socket_fd, OSP_EVENT_READ, 0);
        if (i_nb_fds > 0)
        {
            i_nb_bytes_available = osp_socket_f_getavailable(p_sgcc_socket->it_socket_fd);
            if (i_nb_bytes_available == 0)
            {
                p_sgcc_socket->it_socket_state = E_LESS_CLOSING;
                OS_DBG_LOG(("lxzat_callback_rawmode_tcpclient_f_exec,i_id_socket=%d, closed!\r\n", i_id_socket));
            }
        }
    }

    if (p_sgcc_socket->it_socket_state == E_LESS_CLOSING)
    {
        i_nb_bytes_available = osp_socket_f_getavailable(p_sgcc_socket->it_socket_fd);
        if (i_nb_bytes_available <= 0)
        {
            if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
            {
                lxzat_urc_f_printf(p_sgcc_socket->it_vsp_id, LXZAT_RSP_MODE_P1N1, "$MYURCCLOSE: %d", i_id_socket);
            }

            lxzat_spcomm_f_clear(p_sgcc_socket->it_vsp_id);
            lxzat_spcomm_f_ChangeWorkMode(p_sgcc_socket->it_vsp_id,
                E_LSMX_ATC, LXZAT_END_CHAR_CR, LXZAT_END_CHAR_LF);
            lxzat_sgcc_socket_f_close(i_id_socket);
            OS_DBG_LOG(("lxzat_callback_rawmode_tcpclient_f_exec,i_id_socket=%d, closed!\r\n", i_id_socket));
        }
    }

    if(p_sgcc_socket->it_socket_state == E_LESS_SENDING)
    {
        uint08 * p_data_buf = NULL;
        sint32 i_data_len = 0;
        sint32 i_read_len = 0;
        uint32 i_cur_ticks = 0;
        
        i_cur_ticks = osp_time_tickget();
        if(i_cur_ticks >= (uint32)(gs_sgcc_rawmode_table[p_sgcc_socket->it_channel_id].it_rawmode_timeout & 0x0000FFFF))
        {
            i_data_len = lxz_ring_f_getoption(p_cur_spcfg->pt_rx_ring, E_LRO_DATA_SIZE);
            if(i_data_len > 0)
            {
                p_data_buf = (uint08 *)malloc(i_data_len);
                if (p_data_buf == NULL)
                {
                    OS_DBG_LOG(("lxzat_callback_rawmode_tcpclient_f_exec,p_data_buf malloc error!\r\n"));
                    p_sgcc_socket->it_mark_time = i_cur_ticks;

                    return 0;
                }
                i_read_len = lxz_ring_f_read(p_cur_spcfg->pt_rx_ring, p_data_buf, i_data_len);
                osp_socket_f_write(p_sgcc_socket->it_socket_fd, p_data_buf, i_read_len);
                p_sgcc_socket->it_socket_state = E_LESS_SENDING;
                p_sgcc_socket->it_mark_time = i_cur_ticks;

                free(p_data_buf);
            }
        }
    }

    i_op_status = 1;
    return i_op_status;
}

static sint32 lxzat_callback_rawmode_tcpclient_f_exit(sint32 p1, sint32 p2)
{
    OS_DBG_LOG(("lxzat:lxzat_callback_rawmode_tcpclient_f_exit\r\n"));
    return 1;
}


static sint32 lxzat_callback_rawmode_udpclient_f_exec(sint32 p1, sint32 p2)
{
    sint32 i_op_status = 0;

    sint32 i_nb_fds = 0;
    sint32 i_nb_bytes_read = 0;
    sint32 i_nb_bytes_available = 0;

    sint32 i_id_socket = 0;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    uint08 p_buf_urcinfo[LXZAT_URC_RING_WRITE_LEN];

    i_id_socket = p1;
    if ((i_id_socket < 0) || (i_id_socket > LXZAT_SGCC_NUM_MAX))
    {
        return i_op_status;
    }

    memset(p_buf_urcinfo,0,LXZAT_URC_RING_WRITE_LEN);
    p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzat_callback_rawmode_udpclient_f_exec,i_id_socket=%d,p_sgcc_socket==NULL\r\n", i_id_socket));
        return i_op_status;
    }

    p_cur_spcfg = lxzat_spcomm_f_get(p_sgcc_socket->it_vsp_id);
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzat_callback_rawmode_udpclient_f_exec,i_id_socket=%d,p_cur_spcfg==NULL\r\n", i_id_socket));
        return i_op_status;
    }
    
    if (p_sgcc_socket->it_socket_fd == 0)
    {
        OS_DBG_LOG(("lxzat_callback_rawmode_udpclient_f_exec,it_socket_fd=%d\r\n", p_sgcc_socket->it_socket_fd));
        return i_op_status;
    }

    if (p_sgcc_socket->it_socket_state <= E_LESS_CONNECTING)
    {
        OS_DBG_LOG(("lxzat_callback_rawmode_udpclient_f_exec,it_socket_state=%d\r\n", p_sgcc_socket->it_socket_state));
        return i_op_status;
    }

    if (p_sgcc_socket->it_net_type != LXZAT_NET_TYPE_UDPC)
    {
        OS_DBG_LOG(("lxzat_callback_rawmode_udpclient_f_exec,it_net_type=%d\r\n", p_sgcc_socket->it_net_type));
        return i_op_status;
    }

    if (   (p_sgcc_socket->it_socket_state == E_LESS_ESTABLISHED)
        || (p_sgcc_socket->it_socket_state == E_LESS_SENDING))
    {
        sint32 i_nb_bytes_available = 0;
        i_nb_bytes_available = osp_socket_f_getavailable(p_sgcc_socket->it_socket_fd);
        if (i_nb_bytes_available > 0)
        {
            memset(p_sgcc_socket->pt_rxbuf,0,LXZAT_TRYREAD_LEN_MAX);
            i_nb_bytes_read = osp_socket_f_readfrom(p_sgcc_socket->it_socket_fd,
                p_sgcc_socket->pt_rxbuf,LXZAT_TRYREAD_LEN_MAX);
            
            lxzat_spcomm_f_writebyid(p_sgcc_socket->it_vsp_id,
                p_sgcc_socket->pt_rxbuf, i_nb_bytes_read);
            lxzat_spcomm_f_flush(p_sgcc_socket->it_vsp_id);
        }
    }

    if(p_sgcc_socket->it_socket_state == E_LESS_SENDING)
    {
        uint08 * p_data_buf = NULL;
        sint32 i_data_len = 0;
        sint32 i_read_len = 0;
        uint32 i_cur_ticks = 0;
        
        i_cur_ticks = osp_time_tickget();
        if(i_cur_ticks >= (uint32)(gs_sgcc_rawmode_table[p_sgcc_socket->it_channel_id].it_rawmode_timeout & 0x0000FFFF))
        {
            i_data_len = lxz_ring_f_getoption(p_cur_spcfg->pt_rx_ring, E_LRO_DATA_SIZE);
            if(i_data_len > 0)
            {
                p_data_buf = (uint08 *)malloc(i_data_len);
                if (p_data_buf == NULL)
                {
                    OS_DBG_LOG(("lxzat_callback_rawmode_tcpclient_f_exec,p_data_buf malloc error!\r\n"));
                    p_sgcc_socket->it_mark_time = i_cur_ticks;

                    return 0;
                }
                i_read_len = lxz_ring_f_read(p_cur_spcfg->pt_rx_ring, p_data_buf, i_data_len);
                osp_socket_f_writeto(p_sgcc_socket->it_socket_fd, p_data_buf,
                    i_data_len,p_sgcc_socket->pt_ip_peer, p_sgcc_socket->ut_peer_port);
                p_sgcc_socket->it_socket_state = E_LESS_SENDING;
                p_sgcc_socket->it_mark_time = i_cur_ticks;
                free(p_data_buf);
            }
        }
    }

    i_op_status = 1;
    return i_op_status;
}

static sint32 lxzat_callback_rawmode_udpclient_f_exit(sint32 p1, sint32 p2)
{
    OS_DBG_LOG(("lxzat:lxzat_callback_rawmode_udpclient_f_exit\r\n"));
    return 1;
}

static sint32 lxzat_callback_tcpserver_f_exec(sint32 p1, sint32 p2)
{
    sint32 i_op_status = 0;
    sint32 i_id_svrsocket = 0;
    sint32 i_id_clisocket = 0;
    sint32 p_fd_clisocket = 0;
    uint08 p_ip_peer[20];
    uint16 i_port_peer = 0;

    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_sgcc_socket_t * p_sgcc_svrsocket = NULL;
    lxzat_sgcc_socket_t * p_sgcc_clisocket = NULL;

    i_id_svrsocket = p1;
    p_sgcc_svrsocket = &(gs_sgcc_socket_pool[i_id_svrsocket]);
    p_cur_spcfg = lxzat_spcomm_f_get(p_sgcc_svrsocket->it_vsp_id);
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzat_callback_tcpserver_f_exec,i_id_svrsocket=%d,p_cur_spcfg==NULL\r\n", i_id_svrsocket));
        return i_op_status;
    }

    memset(p_ip_peer, 0, sizeof(p_ip_peer));
    p_fd_clisocket = sgcc_socket_f_accept(p_sgcc_svrsocket->it_socket_fd, p_ip_peer, &i_port_peer);
    if( p_fd_clisocket < 0)
    {
        sint32 i_socket_errno = 0;

        i_socket_errno = osp_socket_f_geterror();
        if (   (i_socket_errno == OSP_SOCKET_EWOULDBLOCK)
            || (i_socket_errno == OSP_SOCKET_EAGAIN))
        {
            return 1;
        }
        else
        {
            OS_DBG_LOG(("lxzat_callback_tcpserver_f_exec,tcps accept error:%d\r\n",i_socket_errno));
            return 0;
        }
    }

    osp_socket_f_keepalive(p_fd_clisocket);
    OS_DBG_LOG(("lxzat_callback_tcpserver_f_exec,sgcc_socket_f_accept:p_fd_clisocket=0x%08x\r\n",p_fd_clisocket));

    i_id_clisocket = 0;
    while(i_id_clisocket < LXZAT_SGCC_NUM_MAX)
    {
        p_sgcc_clisocket = &(gs_sgcc_socket_pool[i_id_clisocket]);
        if((p_sgcc_clisocket->it_socket_state ==E_LESS_IDLE)||
            (p_sgcc_clisocket->it_socket_state ==E_LESS_CONFIG))
        {

            break;
        }
        i_id_clisocket++;

    }

    if(i_id_clisocket < LXZAT_SGCC_NUM_MAX)
    {
        uint32 i = 0;
        for(i = 0;i < AT_MyIpFilter_MAX_NUM;i++)
        {
            if(gastMyIpFilterInfo[i].act_flag == 1)
            {
                break;
            }
        }
        if(i >= AT_MyIpFilter_MAX_NUM)
        {
            if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
            {
                lxzat_urc_f_printf(p_sgcc_svrsocket->it_vsp_id, 
                    LXZAT_RSP_MODE_P1N1, 
                    "$MYURCCLIENT: %d,\"%s\",%d", 
                    i_id_clisocket, p_ip_peer, i_port_peer);
            }

            p_sgcc_clisocket->it_socket_state = E_LESS_ESTABLISHED;
            p_sgcc_clisocket->it_net_type = LXZAT_NET_TYPE_TCPC;
            p_sgcc_clisocket->ut_local_port = p_sgcc_svrsocket->ut_local_port;
            strcpy(p_sgcc_clisocket->pt_ip_peer, p_ip_peer);
            p_sgcc_clisocket->ut_peer_port = i_port_peer;
            p_sgcc_clisocket->it_channel_id = p_sgcc_svrsocket->it_channel_id;
            p_sgcc_clisocket->it_socket_fd = p_fd_clisocket;
            p_sgcc_clisocket->pt_rxbuf = (uint08 *)malloc(LXZAT_TRYREAD_LEN_MAX);
            p_sgcc_clisocket->it_socket_id = i_id_clisocket;
            p_sgcc_clisocket->it_vsp_id = p_sgcc_svrsocket->it_vsp_id;
            p_sgcc_clisocket->it_urc_flag = 1;

            lxzat_task_tcpclient_newtask(i_id_clisocket);
            return 1;
        }
        else
        {
            uint32 aIPaddr;
            uint32 aNetMask;
            for(i = 0;i < AT_MyIpFilter_MAX_NUM;i++)
            {
                if(gastMyIpFilterInfo[i].act_flag == 1)
                {

                    aIPaddr = osp_inet_addr(gastMyIpFilterInfo[i].ip_address);
                    aNetMask = osp_inet_addr(gastMyIpFilterInfo[i].net_mask);
                    if((aIPaddr & aNetMask) == (osp_inet_addr(p_ip_peer) & aNetMask))
                    {
                        sint32 i_snd_buf_size = 0;
                        sint32 i_opt_size = 0;

                        if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
                        {
                            lxzat_urc_f_printf(p_sgcc_svrsocket->it_vsp_id, 
                                LXZAT_RSP_MODE_P1N1, 
                                "$MYURCCLIENT: %d,\"%s\",%d", 
                                i_id_clisocket, p_ip_peer, i_port_peer);
                        }

                        i_snd_buf_size = LXZAT_TCP_SNDBUF_SIZE;
                        i_opt_size = sizeof(sint32);
                        setsockopt(p_sgcc_clisocket->it_socket_fd, SOL_SOCKET, SO_SNDBUF, (const char *)(&i_snd_buf_size), i_opt_size);
                        
                        p_sgcc_clisocket->it_socket_state = E_LESS_ESTABLISHED;
                        p_sgcc_clisocket->it_net_type = LXZAT_NET_TYPE_TCPC;
                        p_sgcc_clisocket->ut_local_port = p_sgcc_svrsocket->ut_local_port;
                        strcpy(p_sgcc_clisocket->pt_ip_peer, p_ip_peer);
                        p_sgcc_clisocket->ut_peer_port = i_port_peer;
                        p_sgcc_clisocket->it_channel_id = p_sgcc_svrsocket->it_channel_id;
                        p_sgcc_clisocket->it_socket_fd = p_fd_clisocket;
                        p_sgcc_clisocket->pt_rxbuf = (uint08 *)malloc(LXZAT_TRYREAD_LEN_MAX);
                        p_sgcc_clisocket->it_socket_id = i_id_clisocket;
                        p_sgcc_clisocket->it_vsp_id = p_sgcc_svrsocket->it_vsp_id;
                        p_sgcc_clisocket->it_urc_flag = 1;

                        lxzat_task_tcpclient_newtask(i_id_clisocket);
                        return 1;
                    }

                }

            }

            if(i >= AT_MyIpFilter_MAX_NUM)
            {
                osp_socket_f_close(p_fd_clisocket);
                return 1;
            }
        }
    }

    return 1;
}
static sint32 lxzat_callback_tcpserver_f_exit(sint32 p1, sint32 p2)
{
    OS_DBG_LOG(("lxzat:lxzat_callback_tcpserver_f_exit\r\n"));
    return 1;
}

static sint32 lxzat_callback_ftpcmd_f_exec(sint32 p1, sint32 p2)
{
	sint32 i_op_status = 0;

    sint32 i_vsp_id = 0;
	sint32 i_nb_fds = 0;
	sint32 i_nb_bytes_available = 0;
	sint32 i_fd_cmdsocket = 0;

	lxzat_spcfg_t * p_cur_spcfg = NULL;
	lxz_easyftp_t* p_eftp_ctxt = gsp_eftp_context;
	
	i_vsp_id = p1;
    p_cur_spcfg = lxzat_spcomm_f_get(i_vsp_id);
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzat_callback_ftpcmd_f_exec,i_vsp_id=%d,p_cur_spcfg==NULL\r\n", i_vsp_id));
        return i_op_status;
    }

	if (p_eftp_ctxt == NULL)
    {
		return i_op_status;
	}
	
	i_fd_cmdsocket = p_eftp_ctxt->it_cmd_socket;
    if (p_eftp_ctxt->it_state_cmdsocket == E_EFSS_CONNECT)
    {
        i_nb_fds = osp_socket_f_select(i_fd_cmdsocket, OSP_EVENT_READ, 0);
        if (i_nb_fds > 0)
        {
            i_nb_bytes_available = osp_socket_f_getavailable(i_fd_cmdsocket);
            if (i_nb_bytes_available ==0)
            {
                p_eftp_ctxt->it_state_cmdsocket = E_EFSS_CLOSING;
                OS_DBG_LOG(("lxzat_callback_ftpcmd_f_exec,i_fd_cmdsocket=0x%08X, closing!\r\n", i_fd_cmdsocket));
            }
        }
    }

    if (p_eftp_ctxt->it_state_cmdsocket == E_EFSS_CLOSING)
    {
        i_nb_bytes_available = osp_socket_f_getavailable(i_fd_cmdsocket);
        if (i_nb_bytes_available <= 0)
        {
            lxzat_spcomm_f_clear(i_vsp_id);
            lxzat_spcomm_f_ChangeWorkMode(i_vsp_id,
                E_LSMX_ATC, LXZAT_END_CHAR_CR, LXZAT_END_CHAR_LF);

            if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
            {
                if (p_eftp_ctxt->it_state_datasocket >= E_EFSS_CONNECT)
                {
                    lxzat_urc_f_printf(i_vsp_id, LXZAT_RSP_MODE_P1N1, "%s", "$MYURCFTP: 1");
                }
                lxzat_urc_f_printf(i_vsp_id, LXZAT_RSP_MODE_P1N1, "%s", "$MYURCFTP: 0");
            }

            eftp_ftpdata_f_close(p_eftp_ctxt);
            eftp_ftpcmd_f_close(p_eftp_ctxt);
            free(gsp_eftp_context);
            gsp_eftp_context = NULL;
            OS_DBG_LOG(("lxzat_callback_ftpcmd_f_exec,i_fd_cmdsocket=0x%08X, closed!\r\n", i_fd_cmdsocket));
        }
    }
	
	i_op_status = 1;
	return i_op_status;
}

static sint32 lxzat_callback_ftpcmd_f_exit(sint32 p1, sint32 p2)
{
    OS_DBG_LOG(("lxzat:lxzat_callback_ftpcmd_f_exit\r\n"));
    return 1;
}

static sint32 lxzat_callback_ftpdata_f_exec(sint32 p1, sint32 p2)
{
	sint32 i_op_status = 0;

    sint32 i_vsp_id = 0;
	sint32 i_nb_fds = 0;
	sint32 i_nb_bytes_available = 0;
	sint32 i_fd_datasocket = 0;

	lxzat_spcfg_t * p_cur_spcfg = NULL;
	lxz_easyftp_t* p_eftp_ctxt = gsp_eftp_context;
	
	i_vsp_id = p1;
    p_cur_spcfg = lxzat_spcomm_f_get(i_vsp_id);
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzat_callback_ftpdata_myftpget_f_exec,i_vsp_id=%d,p_cur_spcfg==NULL\r\n", i_vsp_id));
        return i_op_status;
    }

	if (p_eftp_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_callback_ftpdata_myftpget_f_exec,p_eftp_ctxt=0x%08X\r\n", p_eftp_ctxt));
		return i_op_status;
	}
	
	i_fd_datasocket = p_eftp_ctxt->it_data_socket;
    if (p_eftp_ctxt->it_state_datasocket == E_EFSS_IDLE)
    {
		OS_DBG_LOG(("lxzat_callback_ftpdata_myftpget_f_exec,it_state_datasocket=%d\r\n", p_eftp_ctxt->it_state_datasocket));
		return i_op_status;
    }

    if (p_eftp_ctxt->it_state_datasocket == E_EFSS_CONNECT)
    {
        i_nb_fds = osp_socket_f_select(i_fd_datasocket, OSP_EVENT_READ, 0);
        if (i_nb_fds > 0)
        {
            i_nb_bytes_available = osp_socket_f_getavailable(i_fd_datasocket);
            if (i_nb_bytes_available ==0)
            {
                p_eftp_ctxt->it_state_datasocket = E_EFSS_CLOSING;
                OS_DBG_LOG(("lxzat_callback_ftpdata_myftpget_f_exec,i_fd_datasocket=0x%08X, closing!\r\n", i_fd_datasocket));
            }
        }
    }

    if (p_eftp_ctxt->it_state_datasocket == E_EFSS_CLOSING)
    {
        i_nb_bytes_available = osp_socket_f_getavailable(i_fd_datasocket);
        if (i_nb_bytes_available <= 0)
        {
            lxzat_spcomm_f_clear(i_vsp_id);
            lxzat_spcomm_f_ChangeWorkMode(i_vsp_id,
                E_LSMX_ATC, LXZAT_END_CHAR_CR, LXZAT_END_CHAR_LF);

            if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
            {
                lxzat_urc_f_printf(i_vsp_id, LXZAT_RSP_MODE_P1N1, "%s", "$MYURCFTP: 1");
            }

            eftp_ftpdata_f_close(p_eftp_ctxt);
        }
    }
	
	i_op_status = 1;
	return i_op_status;
}

static sint32 lxzat_callback_ftpdata_f_exit(sint32 p1, sint32 p2)
{
    OS_DBG_LOG(("lxzat:lxzat_callback_ftpdata_f_exit\r\n"));
    return 1;
}

static sint32 lxzat_callback_myurcact_f_exec(sint32 p1, sint32 p2)
{
    sint32 i_op_status = 1;
    sint32 i_id_vspctxt = 0;
    sint32 i_id_pdpctxt = 0;
    sint32 i_id_sgccpdpctxt = 0;

    sint32 i_cur_pdpstatus = 0;

    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_nvcfg_t * p_cur_nvcfg = NULL;
    sint08 ll_buf_ipaddr [LXZAT_MAX_LEN_IPV4];

    i_id_vspctxt = p1;
    p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
    p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
    if (p_cur_spcfg == NULL)
    {
        return 0;
    }

    i_id_pdpctxt = p2;
    lxzat_pdpinfo_f_getstatus(i_id_pdpctxt, &i_cur_pdpstatus);
    if (E_PDP_STATUS_ACTIVATED == i_cur_pdpstatus)
    {
        i_op_status = 0;
        i_id_sgccpdpctxt = i_id_pdpctxt - 1;
        memset(ll_buf_ipaddr, 0, sizeof(ll_buf_ipaddr));
        lxzat_pdpinfo_f_getipaddress(i_id_pdpctxt, ll_buf_ipaddr);
        if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
        {
            lxzat_urc_f_printf(i_id_vspctxt, 
                LXZAT_RSP_MODE_P1N1, 
                "$MYURCACT: %d,%d,\"%s\"", 
                i_id_sgccpdpctxt, 1, ll_buf_ipaddr);
        }
    }

    return i_op_status;
}

static sint32 lxzat_callback_myurcact_f_exit(sint32 p1, sint32 p2)
{
    OS_DBG_LOG(("lxzat:lxzat_callback_myurcact_f_exit\r\n"));
    return 1;
}

static sint32 lxzat_callback_myurcdeact_f_exec(sint32 p1, sint32 p2)
{
    sint32 i_op_status = 1;
    sint32 i_id_vspctxt = 0;
    sint32 i_id_pdpctxt = 0;
    sint32 i_id_sgccpdpctxt = 0;

    sint32 i_cur_pdpstatus = 0;
    lxzat_spcfg_t * p_cur_spcfg = NULL;

    i_id_vspctxt = p1;
    p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
    if (p_cur_spcfg == NULL)
    {
        return 0;
    }

    i_id_pdpctxt = p2;
    lxzat_pdpinfo_f_getstatus(i_id_pdpctxt, &i_cur_pdpstatus);
    if (E_PDP_STATUS_IDLE == i_cur_pdpstatus)
    {
        i_op_status = 0;
        i_id_sgccpdpctxt = i_id_pdpctxt - 1;
        if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
        {
            lxzat_urc_f_printf(i_id_vspctxt, 
                LXZAT_RSP_MODE_P1N1, 
                "$MYURCACT: %d,%d,\"%s\"", 
                i_id_sgccpdpctxt, 0, "0.0.0.0");
        }
    }

    return i_op_status;
}

static sint32 lxzat_callback_myurcdeact_f_exit(sint32 p1, sint32 p2)
{
    OS_DBG_LOG(("lxzat:lxzat_callback_myurcdeact_f_exit\r\n"));
    return 1;
}

static sint32 lxzat_callback_myurcclose_f_exec(sint32 p1, sint32 p2)
{
    sint32 i_op_status = 0;

    sint32 i_id_socket = 0;
    sint32 i_id_vspctxt = 0;
    sint32 i_id_pdpctxt = 0;
    sint32 i_id_sgccpdpctxt = 0;

    sint32 i_cur_pdpstatus = 0;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    i_id_vspctxt = p1;
    p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
    if (p_cur_spcfg == NULL)
    {
        return i_op_status;
    }

    i_id_pdpctxt = p2;
    i_id_sgccpdpctxt = i_id_pdpctxt - 1;
    i_id_socket = 0;
    while (i_id_socket < LXZAT_SGCC_NUM_MAX)
    {
        p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
        if (p_sgcc_socket->it_socket_state >= E_LESS_CONNECTING)
        {
            if (p_sgcc_socket->it_channel_id == i_id_sgccpdpctxt)
            {
                lxzat_sgcc_socket_f_close(i_id_socket);
                if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
                {
                    lxzat_urc_f_printf(i_id_vspctxt, 
                        LXZAT_RSP_MODE_P1N1, 
                        "$MYURCCLOSE: %d", 
                        i_id_socket);
                }
            }
        }

        i_id_socket = i_id_socket + 1;
    }

    return i_op_status;
}

static sint32 lxzat_callback_myurcclose_f_exit(sint32 p1, sint32 p2)
{
    OS_DBG_LOG(("lxzat:lxzat_callback_myurcclose_f_exit\r\n"));
    return 1;
}

static sint32 lxzat_callback_myurcftp_f_exec(sint32 p1, sint32 p2)
{
    sint32 i_op_status = 0;

    sint32 i_id_socket = 0;
    sint32 i_id_vspctxt = 0;
    sint32 i_id_pdpctxt = 0;
    sint32 i_id_sgccpdpctxt = 0;

    sint32 i_cur_pdpstatus = 0;
    lxzat_spcfg_t* p_cur_spcfg = NULL;
    lxz_easyftp_t* p_eftp_ctxt = NULL;

    i_id_vspctxt = p1;
    p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
    if (p_cur_spcfg == NULL)
    {
        return i_op_status;
    }

    i_id_pdpctxt = p2;
    i_id_sgccpdpctxt = i_id_pdpctxt - 1;
    p_eftp_ctxt = gsp_eftp_context;
    if (p_eftp_ctxt == NULL)
    {
        return i_op_status;
    }

    if (p_eftp_ctxt->channel_id == i_id_sgccpdpctxt)
    {
        if (p_eftp_ctxt->it_state_datasocket >= E_EFSS_CONNECT)
        {
            if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
            {
                lxzat_urc_f_printf(i_id_vspctxt, 
                    LXZAT_RSP_MODE_P1N1, 
                    "$MYURCFTP: 1");
            }

            eftp_ftpdata_f_close(p_eftp_ctxt);
        }
        
        if (p_eftp_ctxt->it_state_cmdsocket >= E_EFSS_CONNECT)
        {
            if(gMyNetUrcType == AT_MYNETURC_TYPE_ON)
            {
                lxzat_urc_f_printf(i_id_vspctxt, 
                    LXZAT_RSP_MODE_P1N1, 
                    "$MYURCFTP: 0");
            }

            eftp_ftpcmd_f_close(p_eftp_ctxt);
        }
    }

    return i_op_status;
}

static sint32 lxzat_callback_myurcftp_f_exit(sint32 p1, sint32 p2)
{
    OS_DBG_LOG(("lxzat:lxzat_callback_myurcftp_f_exit\r\n"));
    return 1;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYSYSINFO".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mysysinfo_init(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;

    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_resp_mysysinfo_t * p_resp_mysysinfo = NULL;

    if (p_lxzat_ctxt != NULL)
    {
        p_resp_mysysinfo = (lxzat_resp_mysysinfo_t *)malloc(sizeof(lxzat_resp_mysysinfo_t));
        if (p_resp_mysysinfo != NULL)
        {
            memset(p_resp_mysysinfo, 0, sizeof(lxzat_resp_mysysinfo_t));
            p_lxzat_ctxt->pt_rsp_data = p_resp_mysysinfo;

            e_err_code = E_LEC_OK;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The request handler of "AT$MYSYSINFO".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mysysinfo_req(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_resp_mysysinfo_t * p_resp_mysysinfo = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mysysinfo_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mysysinfo_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_EXE:
        {
#ifdef LXZAT_EASYRIL_API
                uint08 u_data_buf[50] = {0};
                sint32 i_op_status = 0;
                ATResponse *p_outResponse = NULL;

                int ret = 0;
                char * line, * out;
                ATLine * p_cur_atline = NULL;
                ATLine * p_nxt_atline = NULL;

                sint32 i_creg_mode = 0;
                sint32 i_creg_stat = 0;
                sint32 i_cgreg_mode = 0;
                sint32 i_cgreg_stat = 0;
                sint32 i_cops_mode = 0;
                sint32 i_cops_format = 0;
                char * p_cops_oper = NULL;
                sint32 i_cops_rat = 0;
                sint32 i_plmn_mcc = 0;
                sint32 i_plmn_mnc = 0;
                sint32 i_mysysinfo_oper = 0;
                sint32 i_mysysinfo_rat = 0;

                sint32 i = 0;
                sint32 i_nb_item = 0;

                /* Step1: Send "AT+CREG?" to C-core, registered or not */
                i_op_status = (sint32)at_send_command_multiline("AT+CREG?", "+CREG: ", &p_outResponse);
                if(i_op_status < 0)
                {
                    OS_DBG_LOG(("lxzat:lxzat_dollar_mysysinfo_req:AT+CREG? error\r\n"));
                    at_response_free(p_outResponse);
                    return E_LEC_OK;
                }
                else if( p_outResponse->success == 0)
                {
                    OS_DBG_LOG(("lxzat:lxzat_dollar_mysysinfo_req:AT+CREG? error:%s\r\n", p_outResponse->finalResponse);
                    at_response_free(p_outResponse);
                    return E_LEC_OK;
                }
                else
                {
                    p_cur_atline = p_outResponse->p_intermediates;
                    if (p_cur_atline == NULL)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    p_nxt_atline = p_cur_atline->p_next;
                    if (p_nxt_atline != NULL)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    line = p_cur_atline->line;
                    ret = at_tok_start(&line);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    ret = at_tok_nextint(&line, &i_creg_mode);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    ret = at_tok_nextint(&line, &i_creg_stat);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    at_response_free(p_outResponse);
                }

                /* Step2: Send "AT+CGREG?" to C-core, registered or not */
                i_op_status = (sint32)at_send_command_multiline("AT+CGREG?", "+CGREG: ", &p_outResponse);
                if(i_op_status < 0)
                {
                    OS_DBG_LOG(("lxzat:lxzat_dollar_mysysinfo_req:AT+CGREG? error\r\n"));
                    at_response_free(p_outResponse);
                    return E_LEC_OK;
                }
                else if( p_outResponse->success == 0)
                {
                    OS_DBG_LOG(("lxzat:lxzat_dollar_mysysinfo_req:AT+CGREG? error:%s\r\n", p_outResponse->finalResponse);
                    at_response_free(p_outResponse);
                    return E_LEC_OK;
                }
                else
                {
                    p_cur_atline = p_outResponse->p_intermediates;
                    if (p_cur_atline == NULL)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    p_nxt_atline = p_cur_atline->p_next;
                    if (p_nxt_atline != NULL)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    line = p_cur_atline->line;
                    ret = at_tok_start(&line);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    ret = at_tok_nextint(&line, &i_cgreg_mode);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    ret = at_tok_nextint(&line, &i_cgreg_stat);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    at_response_free(p_outResponse);
                }

                if (((i_creg_stat != 1) && (i_creg_stat != 5)) &&
                    ((i_cgreg_stat != 1) && (i_cgreg_stat != 5)))
                {
                    return E_LEC_OK;
                }

                /* Step3: Send "AT+COPS?" to C-core, get the mode of mobile network */
                i_op_status = (sint32)at_send_command_multiline("AT+COPS?", "+COPS: ", &p_outResponse);
                if(i_op_status < 0)
                {
                    OS_DBG_LOG(("lxzat:lxzat_dollar_mysysinfo_req:AT+COPS? error\r\n"));
                    at_response_free(p_outResponse);
                }
                else if( p_outResponse->success == 0)
                {
                    OS_DBG_LOG(("lxzat:lxzat_dollar_mysysinfo_req:AT+COPS? error:%s\r\n", p_outResponse->finalResponse);
                    at_response_free(p_outResponse);
                }
                else
                {
                    p_cur_atline = p_outResponse->p_intermediates;
                    if (p_cur_atline == NULL)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    p_nxt_atline = p_cur_atline->p_next;
                    if (p_nxt_atline != NULL)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    line = p_cur_atline->line;
                    ret = at_tok_start(&line);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    ret = at_tok_nextint(&line, &i_cops_mode);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    ret = at_tok_nextint(&line, &i_cops_format);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    ret = at_tok_nextstr(&line, &p_cops_oper);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    ret = at_tok_nextint(&line, &i_cops_rat);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    at_response_free(p_outResponse);
                }

                /* Step4: Send "AT^PLMN?" to C-core, get MCC and MNC */
                i_op_status = (sint32)at_send_command_multiline("AT^PLMN?", "^PLMN: ", &p_outResponse);
                if(i_op_status < 0)
                {
                    OS_DBG_LOG(("lxzat:lxzat_dollar_mysysinfo_req:AT+PLMN? error\r\n"));
                    at_response_free(p_outResponse);
                    return E_LEC_OK;
                }
                else if( p_outResponse->success == 0)
                {
                    OS_DBG_LOG(("lxzat:lxzat_dollar_mysysinfo_req:AT+PLMN? error:%s\r\n", p_outResponse->finalResponse);
                    at_response_free(p_outResponse);
                    return E_LEC_OK;
                }
                else
                {
                    p_cur_atline = p_outResponse->p_intermediates;
                    if (p_cur_atline == NULL)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    p_nxt_atline = p_cur_atline->p_next;
                    if (p_nxt_atline != NULL)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    line = p_cur_atline->line;
                    ret = at_tok_start(&line);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    ret = at_tok_nextint(&line, &i_plmn_mcc);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    ret = at_tok_nextint(&line, &i_plmn_mnc);
                    if (ret < 0)
                    {
                        at_response_free(p_outResponse);
                        return E_LEC_OK;
                    }

                    at_response_free(p_outResponse);
                }

                /* step5: find and match, get current oper and rat */
                i = 0;
                i_nb_item = sizeof(gs_mysysinfo_rat_table)/sizeof(gs_mysysinfo_rat_table[0]);
                while (i<i_nb_item)
                {
                    if (gs_mysysinfo_rat_table[i].it_cops_rat == i_cops_rat)
                    {
                        i_mysysinfo_rat = gs_mysysinfo_rat_table[i].it_mysysinfo_rat;
                        break;
                    }

                    i++;
                }

                i = 0;
                i_nb_item = sizeof(gs_mysysinfo_oper_table)/sizeof(gs_mysysinfo_oper_table[0]);
                while (i<i_nb_item)
                {
                    if (   (gs_mysysinfo_oper_table[i].it_mn_mcc == i_plmn_mcc)
                        && (gs_mysysinfo_oper_table[i].it_mn_mnc == i_plmn_mnc))
                    {
                        i_mysysinfo_oper = gs_mysysinfo_oper_table[i].it_mysysinfo_oper;
                        break;
                    }

                    i++;
                }

                p_resp_mysysinfo = ((lxzat_resp_mysysinfo_t *)(p_lxzat_ctxt->pt_rsp_data));
                p_resp_mysysinfo->it_mn_mode = i_mysysinfo_rat;
                p_resp_mysysinfo->it_mn_operator = i_mysysinfo_oper;
#else  /* LXZAT_EASYRIL_API */
                p_resp_mysysinfo = ((lxzat_resp_mysysinfo_t *)(p_lxzat_ctxt->pt_rsp_data));
                p_resp_mysysinfo->it_mn_mode = 4;
                p_resp_mysysinfo->it_mn_operator = 2;
#endif /* LXZAT_EASYRIL_API */

            break;
        }

    default:
        {
            e_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYSYSINFO".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mysysinfo_resp(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_resp_mysysinfo_t * p_resp_mysysinfo = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mysysinfo_resp,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mysysinfo_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_EXE:
        {
            p_resp_mysysinfo = ((lxzat_resp_mysysinfo_t *)(p_lxzat_ctxt->pt_rsp_data));
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %d,%02d",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                p_resp_mysysinfo->it_mn_mode,
                p_resp_mysysinfo->it_mn_operator);
            break;
        }

    default:
        {
            e_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYSYSINFO".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mysysinfo_reset(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;

    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_resp_mysysinfo_t * p_resp_mysysinfo = NULL;

    if (p_lxzat_ctxt != NULL)
    {
        p_resp_mysysinfo = ((lxzat_resp_mysysinfo_t *)(p_lxzat_ctxt->pt_rsp_data));
        if (p_resp_mysysinfo != NULL)
        {
            free(p_resp_mysysinfo);
            p_resp_mysysinfo = NULL;

            e_err_code = E_LEC_OK;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYSYSMODE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mysysmode_init(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
    return e_err_code;
}

/*
 *  Description:
 *    The request handler of "AT$MYSYSMODE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mysysmode_req(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_resp_mysysinfo_t * p_resp_mysysinfo = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mysysmode_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mysysmode_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
#ifdef LXZAT_EASYRIL_API
            uint08 u_data_buf[100] = {0};
            sint32 i_op_status = 0;
            ATResponse *p_outResponse = NULL;

            int ret = 0;
            char * line, * out;
            ATLine * p_cur_atline = NULL;
            ATLine * p_nxt_atline = NULL;

            sint32 i_new_mode = 0;

            if (p_cur_req->it_nb_param != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_mysysmode_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }
            
            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mysysmode_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }
            
            i_new_mode = PARAM1(p_cur_req).it_number;
            switch (i_new_mode)
            {
            case 0:
                {
                    memset(u_data_buf, 0, sizeof(u_data_buf));
                    strcpy(u_data_buf, "AT^SYSCFGEX=\"030102\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,0,0");
                    if (access("/data/myconfig/lstnetorder.cfg", F_OK) == 0)
                    {
                        system("busybox rm -f /data/myconfig/lstnetorder.cfg");
                    }
                    break;
                }
            case 2:
                {
                    memset(u_data_buf, 0, sizeof(u_data_buf));
                    strcpy(u_data_buf, "AT^SYSCFGEX=\"01\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,0,0");
                    if (access("/data/myconfig/", F_OK) < 0)
                    {
                        system("busybox mkdir -p /data/myconfig/");
                    }
                    if (access("/data/myconfig/lstnetorder.cfg", F_OK) != 0)
                    {
                        system("busybox touch /data/myconfig/lstnetorder.cfg");
                    }
                    break;
                }
            case 3:
                {
                    memset(u_data_buf, 0, sizeof(u_data_buf));
                    strcpy(u_data_buf, "AT^SYSCFGEX=\"02\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,0,0");
                    if (access("/data/myconfig/", F_OK) < 0)
                    {
                        system("busybox mkdir -p /data/myconfig/");
                    }
                    if (access("/data/myconfig/lstnetorder.cfg", F_OK) != 0)
                    {
                        system("busybox touch /data/myconfig/lstnetorder.cfg");
                    }
                    break;
                }
            case 4:
                {
                    memset(u_data_buf, 0, sizeof(u_data_buf));
                    strcpy(u_data_buf, "AT^SYSCFGEX=\"03\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,0,0");
                    if (access("/data/myconfig/", F_OK) < 0)
                    {
                        system("busybox mkdir -p /data/myconfig/");
                    }
                    if (access("/data/myconfig/lstnetorder.cfg", F_OK) != 0)
                    {
                        system("busybox touch /data/myconfig/lstnetorder.cfg");
                    }
                    break;
                }
            default:
                {
                    OS_DBG_LOG(("lxzat_dollar_mysysmode_req,param1 error:%d!\r\n", i_new_mode);
                    return  E_LEC_ERR_P_RANGE;
                }
            }

            /* Step1: Send "AT^SYSCFGEX" to C-core */
            i_op_status = (sint32)at_send_command_multiline(u_data_buf, "^SYSCFGEX: ", &p_outResponse);
            if(i_op_status < 0)
            {
                OS_DBG_LOG(("lxzat:lxzat_dollar_mysysmode_req:AT^SYSCFGEX error\r\n"));
                at_response_free(p_outResponse);
                return E_LEC_ERR_UNKNOWN;
            }
            else if( p_outResponse->success == 0)
            {
                OS_DBG_LOG(("lxzat:lxzat_dollar_mysysmode_req:AT^SYSCFGEX error:%s\r\n", p_outResponse->finalResponse);
                at_response_free(p_outResponse);
                return E_LEC_OK_NOTHING;
            }
            else
            {
                at_response_free(p_outResponse);
            }
#endif /* LXZAT_EASYRIL_API */
        break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            e_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYSYSMODE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mysysmode_resp(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_resp_mysysinfo_t * p_resp_mysysinfo = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mysysmode_resp,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mysysmode_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: 0,2,3,4",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            e_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYSYSMODE".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mysysmode_reset(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
    return e_err_code;
}


/*
 *  Description:
 *    The initialize handler of "AT$MYMODEM".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mymodem_init(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
    return e_err_code;
}

/*
 *  Description:
 *    The request handler of "AT$MYMODEM".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mymodem_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    uint08 i_trans_mode;
    uint16 i_net_type;

    uint08 ucSupTransMode = 0x01;
    uint08 ucSupUnTransMode = 0x02;

    uint08 ucGprs = 0x01;
    uint08 ucCdma = 0x02;
    uint08 ucTdScdma = 0x04;
    uint08 ucWdma = 0x08;
    uint08 ucCdmaEvdo = 0x10;
    uint08 ucTDlte = 0x20;
    uint08 ucLTEfdd = 0x40;
    uint08 ucExtendBitFlag2 = 0x00;


    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mytype_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mytype_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_READ:
        {        
            i_trans_mode =  ucSupTransMode |  ucSupUnTransMode;
            i_net_type = (ucGprs | ucTdScdma | ucWdma | ucTDlte | ucLTEfdd) | (ucExtendBitFlag2 << 8);
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %02X,%04X",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                i_trans_mode,
                i_net_type);
            break;
        }
    default:
        {
            i_err_code = E_LEC_SGCC_ERROR;
            break;
        }
    }

    return i_err_code;
}


/*
 *  Description:
 *    The response handler of "AT$MYMODEM".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mymodem_resp(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
    return e_err_code;   
}

/*
 *  Description:
 *    The reset handler of "AT$MYMODEM".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mymodem_reset(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
    return e_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETINFO".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */

static sint32 lxzat_dollar_mynetinfo_init(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
    return e_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETINFO".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetinfo_req(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetinfo_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetinfo_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
#ifdef LXZAT_EASYRIL_API
            uint08 u_data_buf[100] = {0};
            sint32 i_op_status = 0;
            ATResponse *p_outResponse = NULL;

            int ret = 0;
            char * line, * out;
            ATLine * p_cur_atline = NULL;
            ATLine * p_nxt_atline = NULL;

            sint32 i_new_mode = 0;

            if (p_cur_req->it_nb_param != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetinfo_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }
            
            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetinfo_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }
            
            i_new_mode = PARAM1(p_cur_req).it_number;
            switch (i_new_mode)
            {
            case 1:
                {
                    memset(u_data_buf, 0, sizeof(u_data_buf));
                    strcpy(u_data_buf, "AT^SYSCFGEX=\"00\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,0,0");
                    if (access("/data/myconfig/lstnetorder.cfg", F_OK) == 0)
                    {
                        system("busybox rm -f /data/myconfig/lstnetorder.cfg");
                    }
                    break;
                }
            case 2:
                {
                    memset(u_data_buf, 0, sizeof(u_data_buf));
                    strcpy(u_data_buf, "AT^SYSCFGEX=\"01\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,0,0");
                    if (access("/data/myconfig/", F_OK) < 0)
                    {
                        system("busybox mkdir -p /data/myconfig/");
                    }
                    if (access("/data/myconfig/lstnetorder.cfg", F_OK) != 0)
                    {
                        system("busybox touch /data/myconfig/lstnetorder.cfg");
                    }
                    break;
                }
            case 3:
                {
                    memset(u_data_buf, 0, sizeof(u_data_buf));
                    strcpy(u_data_buf, "AT^SYSCFGEX=\"02\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,0,0");
                    if (access("/data/myconfig/", F_OK) < 0)
                    {
                        system("busybox mkdir -p /data/myconfig/");
                    }
                    if (access("/data/myconfig/lstnetorder.cfg", F_OK) != 0)
                    {
                        system("busybox touch /data/myconfig/lstnetorder.cfg");
                    }
                    break;
                }
            case 4:
                {
                    memset(u_data_buf, 0, sizeof(u_data_buf));
                    strcpy(u_data_buf, "AT^SYSCFGEX=\"03\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,0,0");
                    if (access("/data/myconfig/", F_OK) < 0)
                    {
                        system("busybox mkdir -p /data/myconfig/");
                    }
                    if (access("/data/myconfig/lstnetorder.cfg", F_OK) != 0)
                    {
                        system("busybox touch /data/myconfig/lstnetorder.cfg");
                    }
                    break;
                }
            case 5:
                {
                    memset(u_data_buf, 0, sizeof(u_data_buf));
                    strcpy(u_data_buf, "AT^SYSCFGEX=\"0201\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,0,0");
                    if (access("/data/myconfig/", F_OK) < 0)
                    {
                        system("busybox mkdir -p /data/myconfig/");
                    }
                    if (access("/data/myconfig/lstnetorder.cfg", F_OK) != 0)
                    {
                        system("busybox touch /data/myconfig/lstnetorder.cfg");
                    }
                    break;
                }
            case 6:
                {
                    memset(u_data_buf, 0, sizeof(u_data_buf));
                    strcpy(u_data_buf, "AT^SYSCFGEX=\"0301\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,0,0");
                    if (access("/data/myconfig/", F_OK) < 0)
                    {
                        system("busybox mkdir -p /data/myconfig/");
                    }
                    if (access("/data/myconfig/lstnetorder.cfg", F_OK) != 0)
                    {
                        system("busybox touch /data/myconfig/lstnetorder.cfg");
                    }
                    break;
                }
            case 7:
                {
                    memset(u_data_buf, 0, sizeof(u_data_buf));
                    strcpy(u_data_buf, "AT^SYSCFGEX=\"0302\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,0,0");
                    if (access("/data/myconfig/", F_OK) < 0)
                    {
                        system("busybox mkdir -p /data/myconfig/");
                    }
                    if (access("/data/myconfig/lstnetorder.cfg", F_OK) != 0)
                    {
                        system("busybox touch /data/myconfig/lstnetorder.cfg");
                    }
                    break;
                }
            default:
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetinfo_req,param1 error:%d!\r\n", i_new_mode);
                    return  E_LEC_SGCC_PARAM_NOT_CORRECT;
                }
            }

            /* Step1: Send "AT^SYSCFGEX" to C-core */
            i_op_status = (sint32)at_send_command_multiline(u_data_buf, "^SYSCFGEX: ", &p_outResponse);
            if(i_op_status < 0)
            {
                OS_DBG_LOG(("lxzat:lxzat_dollar_mynetinfo_req:AT^SYSCFGEX error\r\n"));
                at_response_free(p_outResponse);
                return E_LEC_ERR_UNKNOWN;
            }
            else if( p_outResponse->success == 0)
            {
                OS_DBG_LOG(("lxzat:lxzat_dollar_mynetinfo_req:AT^SYSCFGEX error:%s\r\n", p_outResponse->finalResponse);
                at_response_free(p_outResponse);
                return E_LEC_ERR_UNKNOWN;
            }
            else
            {
                at_response_free(p_outResponse);
            }
#endif /* LXZAT_EASYRIL_API */
        break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            e_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return e_err_code;
}


/*
 *  Description:
 *    The response handler of "AT$MYNETINFO".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetinfo_resp(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetinfo_resp,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetinfo_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: 1-7",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            e_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return e_err_code;
}


/*
 *  Description:
 *    The response handler of "AT$MYNETINFO".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetinfo_reset(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
    return e_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETORDER".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */

static sint32 lxzat_dollar_mynetorder_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETORDER".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetorder_req(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            sint32 i_op_status = 0;
            switch (p_cur_req->it_nb_param)
            {
                case 1:
                {
                    sint32 i_1st_value = 0;
                    sint32 i_1st_nettype = 0;

                    if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,param1 type error!\r\n"));
                        return E_LEC_ERR_P_TYPE;
                    }

                    /* 0: default order; 
                     * 2: 2G only;
                     * 3: 3G only;
                     * 4: 4G only;
                     */
                    i_1st_value = PARAM1(p_cur_req).it_number;
                    if ((i_1st_value >= 2) && (i_1st_value <= 4))
                    {
                        i_1st_nettype = i_1st_value - 1;
                        if (access("/data/myconfig/", F_OK) < 0)
                        {
                            system("mkdir -p /data/myconfig/");
                        }
                        if (access("/data/myconfig/lstnetorder.cfg", F_OK) != 0)
                        {
                            system("touch /data/myconfig/lstnetorder.cfg");
                        }
                    }
                    else
                    {
                        if (0 != i_1st_value)
                        {
                            OS_DBG_LOG(("lxzat_dollar_mynetorder_req,param1 range error!\r\n"));
                            return E_LEC_ERR_P_RANGE;
                        }
                        i_1st_nettype = i_1st_value;
                        if (access("/data/myconfig/lstnetorder.cfg", F_OK) == 0)
                        {
                            system("rm -f /data/myconfig/lstnetorder.cfg");
                        }
                    }
                    break;
                }
                
                case 2:
                {
                    sint32 i_1st_value = 0;
                    sint32 i_2nd_value = 0;
                    sint32 i_1st_nettype = 0;
                    sint32 i_2nd_nettype = 0;

                    if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,param1 type error!\r\n"));
                        return E_LEC_ERR_P_TYPE;
                    }

                    /* 0: ERROR; 
                     * 2: 2G first;
                     * 3: 3G first;
                     * 4: 4G first;
                     */
                    i_1st_value = PARAM1(p_cur_req).it_number;
                    if ((i_1st_value >= 2) && (i_1st_value <= 4))
                    {
                        i_1st_nettype = i_1st_value - 1;
                    }
                    else
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,param1 range error!\r\n"));
                        return E_LEC_ERR_P_RANGE;
                    }

                    if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,param2 type error!\r\n"));
                        return E_LEC_ERR_P_TYPE;
                    }

                    /* 0: ERROR; 
                     * 2: 2G second;
                     * 3: 3G second;
                     * 4: 4G second;
                     */
                    i_2nd_value = PARAM2(p_cur_req).it_number;
                    if ((i_2nd_value >= 2) && (i_2nd_value <= 4))
                    {
                        i_2nd_nettype = i_2nd_value - 1;
                    }
                    else
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,param2 range error!\r\n"));
                        return E_LEC_ERR_P_RANGE;
                    }

                    if (i_1st_nettype == i_2nd_nettype)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,param2==param1 error!\r\n"));
                        return E_LEC_ERR_P_RANGE;
                    }

                    if (access("/data/myconfig/", F_OK) < 0)
                    {
                        system("busybox mkdir -p /data/myconfig/");
                    }
                    if (access("/data/myconfig/lstnetorder.cfg", F_OK) != 0)
                    {
                        system("busybox touch /data/myconfig/lstnetorder.cfg");
                    }

                    break;
                }
                
                case 3:
                {
                    sint32 i_1st_value = 0;
                    sint32 i_2nd_value = 0;
                    sint32 i_3rd_value = 0;
                    sint32 i_1st_nettype = 0;
                    sint32 i_2nd_nettype = 0;
                    sint32 i_3rd_nettype = 0;

                    if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,param1 type error!\r\n"));
                        return E_LEC_ERR_P_TYPE;
                    }

                    /* 0: ERROR; 
                     * 2: 2G first;
                     * 3: 3G first;
                     * 4: 4G first;
                     */
                    i_1st_value = PARAM1(p_cur_req).it_number;
                    if ((i_1st_value >= 2) && (i_1st_value <= 4))
                    {
                        i_1st_nettype = i_1st_value - 1;
                    }
                    else
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,param1 range error!\r\n"));
                        return E_LEC_ERR_P_RANGE;
                    }

                    if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,param2 type error!\r\n"));
                        return E_LEC_ERR_P_TYPE;
                    }

                    /* 0: ERROR; 
                     * 2: 2G second;
                     * 3: 3G second;
                     * 4: 4G second;
                     */
                    i_2nd_value = PARAM2(p_cur_req).it_number;
                    if ((i_2nd_value >= 2) && (i_2nd_value <= 4))
                    {
                        i_2nd_nettype = i_2nd_value - 1;
                    }
                    else
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,param2 range error!\r\n"));
                        return E_LEC_ERR_P_RANGE;
                    }

                    if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,param3 type error!\r\n"));
                        return E_LEC_ERR_P_TYPE;
                    }

                    /* 0: ERROR; 
                     * 2: 2G third;
                     * 3: 3G third;
                     * 4: 4G third;
                     */
                    i_3rd_value = PARAM3(p_cur_req).it_number;
                    if ((i_3rd_value >= 2) && (i_3rd_value <= 4))
                    {
                        i_3rd_nettype = i_3rd_value - 1;
                    }
                    else
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,param2 range error!\r\n"));
                        return E_LEC_ERR_P_RANGE;
                    }

                    if (   (i_1st_nettype == i_2nd_nettype)
                        || (i_1st_nettype == i_3rd_nettype)
                        || (i_2nd_nettype == i_3rd_nettype)
                        )
                    {
                        OS_DBG_LOG(("lxzat_dollar_mynetorder_req,must not equal!\r\n"));
                        return E_LEC_ERR_P_RANGE;
                    }

                    if (access("/data/myconfig/", F_OK) < 0)
                    {
                        system("mkdir -p /data/myconfig/");
                    }
                    if (access("/data/myconfig/lstnetorder.cfg", F_OK) != 0)
                    {
                        system("touch /data/myconfig/lstnetorder.cfg");
                    }

                    break;
                }
                
                default:
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetorder_req, i_nb_param=%d,error!\r\n", p_cur_req->it_nb_param));
                    return  E_LEC_SGCC_PARAM_NOT_CORRECT;
                }
            }
        break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            e_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return e_err_code;
}


/*
 *  Description:
 *    The response handler of "AT$MYNETORDER".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetorder_resp(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetorder_resp,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetorder_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <(0,2-4)>[,(2-4)[,(2-4)]]",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            e_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return e_err_code;
}


/*
 *  Description:
 *    The response handler of "AT$MYNETORDER".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetorder_reset(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
    return e_err_code;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYNETPUT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetput_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYNETPUT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetput_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_id_socket = 0;
    sint32 i_write_len = 0;
    sint32 i_string_type = 0;
    sint32 i_string_len = 0;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetput_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetput_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            if (p_cur_req->it_nb_param != 3)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetput_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetput_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetput_req,param2 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetput_req,param3 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket > LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetput_req,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            i_string_type= PARAM2(p_cur_req).it_number;
            if(i_string_type < 0 || i_string_type > 1)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetput_req,i_string_type=%d\r\n",i_string_type));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            if (p_sgcc_socket->it_socket_state != E_LESS_ESTABLISHED)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetput_req,socket is not active\r\n"));
                return E_LEC_SGCC_SOCKET_NO_CONNECT;
            }

            memset(p_sgcc_socket->pt_rxbuf, 0, sizeof(p_sgcc_socket->it_rxbuf_size));
            i_string_len = lxz_dstring_getlength(PARAM3(p_cur_req).pt_str);
            if(i_string_len < LXZAT_TRYWRITE_LEN_MIN || i_string_len > LXZAT_TRYWRITE_LEN_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetput_req,i_nb_trywrite: %d\r\n",i_string_len));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            lxz_dstring_get(PARAM3(p_cur_req).pt_str, p_sgcc_socket->pt_rxbuf, p_sgcc_socket->it_rxbuf_size);
            p_sgcc_socket->it_rxdata_len = strlen(p_sgcc_socket->pt_rxbuf);

            if (i_string_type == 1)
            {
                sint32 i_op_status = 0;

                i_op_status = lxz_string_f_hex2bin(p_sgcc_socket->pt_rxbuf, p_sgcc_socket->it_rxdata_len, 
                        p_sgcc_socket->pt_rxbuf);
                if (0 == i_op_status)
                {
                    return E_LEC_SGCC_PARAM_NOT_CORRECT;
                }

                p_sgcc_socket->it_rxdata_len = (p_sgcc_socket->it_rxdata_len >> 1);
            }

            if (p_sgcc_socket->it_net_type == LXZAT_NET_TYPE_UDPC)
            {
                osp_socket_f_writeto(p_sgcc_socket->it_socket_fd, p_sgcc_socket->pt_rxbuf,
                        p_sgcc_socket->it_rxdata_len, p_sgcc_socket->pt_ip_peer, p_sgcc_socket->ut_peer_port);
            }
            else
            {
#ifdef LXZAT_LINUX
                sint32 i_op_status = 0;
                sint32 i_snd_buf_size = 0;
                sint32 i_opt_size = 0;
                sint32 i_nb_bytes_sending = 0;
                sint32 i_nb_bytes_free = 0;

                i_opt_size = sizeof(sint32);
                i_op_status = getsockopt(p_sgcc_socket->it_socket_fd, SOL_SOCKET,
                    SO_SNDBUF, &i_snd_buf_size, &i_opt_size);
                if (i_op_status != 0)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetput_req,get socket option error: %d\r\n",i_op_status));
                    return E_LEC_SGCC_UNKNOWN;
                }

                i_op_status = ioctl(p_sgcc_socket->it_socket_fd, SIOCOUTQ, (char *)&i_nb_bytes_sending);
                if (i_op_status < 0)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetput_req,get socket check cout buffer size error: %d\r\n",i_op_status));
                    return E_LEC_SGCC_UNKNOWN;
                }

                i_snd_buf_size = i_snd_buf_size/2;
                i_nb_bytes_free = i_snd_buf_size - i_nb_bytes_sending;
                if (i_nb_bytes_free < p_sgcc_socket->it_rxdata_len)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetput_req,free buffer size is not enough!\r\n"));
                    return E_LEC_SGCC_UNKNOWN;
                }
#endif /* LXZAT_LINUX */
                osp_socket_f_write(p_sgcc_socket->it_socket_fd, p_sgcc_socket->pt_rxbuf, p_sgcc_socket->it_rxdata_len);
            }
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETPUT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetput_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_id_socket = 0;
    sint32 i_read_len = 0;
    sint32 i_data_len = 0;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetput_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetput_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket > LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetput_resp,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_SGCC_PARAM_NOT_CORRECT;
            }

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            if (p_sgcc_socket->it_socket_state != E_LESS_ESTABLISHED)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetput_resp,socket is not active\r\n"));
                return E_LEC_SGCC_SOCKET_NO_CONNECT;
            }

            if (p_sgcc_socket->it_net_type == LXZAT_NET_TYPE_UDPC)
            {
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: %d,%d,%d",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    i_id_socket,
                    0,
                    LXZAT_UDP_SNDBUF_SIZE);
            }
            else
            {
                sint32 i_op_status = 0;
                sint32 i_snd_buf_size = 0;
                sint32 i_opt_size = 0;
                sint32 i_nb_bytes_sending = 0;
                sint32 i_nb_bytes_free = 0;
#ifdef LXZAT_LINUX
                i_opt_size = sizeof(sint32);
                i_op_status = getsockopt(p_sgcc_socket->it_socket_fd, SOL_SOCKET,
                    SO_SNDBUF, &i_snd_buf_size, &i_opt_size);
                if (i_op_status != 0)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetput_resp,getsockopt,i_op_status=%d%d\r\n",i_op_status));
                    return E_LEC_SGCC_UNKNOWN;
                }

                i_op_status = ioctl(p_sgcc_socket->it_socket_fd, SIOCOUTQ, (char *)&i_nb_bytes_sending);
                if (i_op_status < 0)
                {
                    OS_DBG_LOG(("lxzat_dollar_mynetput_resp,ioctl,i_op_status=%d\r\n",i_op_status));
                    return E_LEC_SGCC_UNKNOWN;
                }

                i_snd_buf_size = i_snd_buf_size/2;
                i_nb_bytes_free = i_snd_buf_size - i_nb_bytes_sending;
#endif /* LXZAT_LINUX */
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: %d,%d,%d",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    i_id_socket,
                    i_nb_bytes_sending,
                    i_nb_bytes_free);
            }
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <SocketID>,<StringType>,<\"StringContent\">",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);

            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNKNOWN;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYNETPUT".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetput_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYNETGET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetget_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYNETGET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetget_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_id_socket = 0;
    sint32 i_read_len = 0;
    sint32 i_view_mode = 0;
    sint32 i_nb_tryread = 0;
    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetget_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetget_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            if (p_cur_req->it_nb_param != 3)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetget_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetget_req,param1 type is error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetget_req,param2 type is error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            if (PARAM3_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetget_req,param3 type is error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket > LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetget_req,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_ERR_UNSUPPORTED;
            }

            i_view_mode = PARAM2(p_cur_req).it_number;
            if(i_view_mode < 0 || i_view_mode > 1)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetget_req,i_view_mode=%d\r\n",i_view_mode));
                return E_LEC_ERR_P_RANGE;
            }

            i_nb_tryread = PARAM3(p_cur_req).it_number;
            if(i_nb_tryread < LXZAT_TRYREAD_LEN_MIN || i_nb_tryread > LXZAT_TRYREAD_LEN_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetget_req,i_nb_tryread=%d\r\n",i_nb_tryread));
                return E_LEC_ERR_UNSUPPORTED;
            }

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            if (p_sgcc_socket->it_socket_state < E_LESS_ESTABLISHED)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetget_req,socket is not active\r\n"));
                return E_LEC_SGCC_SOCKET_NO_CONNECT;
            }

            if (p_sgcc_socket->it_net_type == LXZAT_NET_TYPE_UDPC)
            {
                i_read_len = osp_socket_f_readfrom(p_sgcc_socket->it_socket_fd,
                    p_sgcc_socket->pt_rxbuf,i_nb_tryread);
            }
            else
            {
                sint32 i_nb_bytes = 0;
                i_nb_bytes = osp_socket_f_getavailable(p_sgcc_socket->it_socket_fd);
                if (i_nb_bytes > 0)
                {
                    i_read_len = osp_socket_f_read(p_sgcc_socket->it_socket_fd,
                        p_sgcc_socket->pt_rxbuf,i_nb_tryread);
                }
            }
            p_sgcc_socket->it_rxdata_len = i_read_len;
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYNETGET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetget_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    sint32 i_id_socket = 0;
    sint32 i_read_len = 0;
    sint32 i_view_mode = 0;
    sint32 i_nb_tryread = 0;

    lxzat_sgcc_socket_t * p_sgcc_socket = NULL;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetget_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetget_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            i_id_socket = PARAM1(p_cur_req).it_number;
            if(i_id_socket < 0 || i_id_socket > LXZAT_SGCC_NUM_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetget_resp,i_id_socket=%d\r\n",i_id_socket));
                return E_LEC_ERR_UNSUPPORTED;
            }

            i_view_mode = PARAM2(p_cur_req).it_number;
            if(i_view_mode < 0 || i_view_mode > 1)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetget_resp,i_view_mode=%d\r\n",i_view_mode));
                return E_LEC_ERR_P_RANGE;
            }

            i_nb_tryread= PARAM3(p_cur_req).it_number;
            if(i_nb_tryread < LXZAT_TRYREAD_LEN_MIN || i_nb_tryread > LXZAT_TRYREAD_LEN_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetget_resp, i_nb_tryread=%d\r\n",i_nb_tryread));
                return E_LEC_ERR_UNSUPPORTED;
            }

            p_sgcc_socket = &(gs_sgcc_socket_pool[i_id_socket]);
            i_read_len = p_sgcc_socket->it_rxdata_len;

            if (i_read_len > 0)
            {
                if (i_read_len < i_nb_tryread)
                {
                    p_sgcc_socket->it_urc_flag = 0;
                }

                if (i_view_mode == LXZAT_VIEW_MODE_TXT)
                {
                    lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P1N1,
                        "%s: %d,%d",
                        p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                        i_id_socket,
                        i_read_len);
                    lxzat_rsp_f_printfhex(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P0N0,
                        p_sgcc_socket->pt_rxbuf,
                        i_read_len);
                }
                else
                {
                    lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P1N1,
                        "%s: %d,%d",
                        p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                        i_id_socket,
                        i_read_len);
                    lxzat_rsp_f_printfbin(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P0N0,
                        p_sgcc_socket->pt_rxbuf,
                        i_read_len);
                }

            }
            else
            {
                p_sgcc_socket->it_urc_flag = 0;
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: %d,%d",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    i_id_socket,
                    0);
            }

            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <SocketID>,<ViewMode>,<TryGetLength>",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);

            break;
        }

    default:
        {
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYNETGET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mynetget_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYTIMESET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytimeset_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYTIMESET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytimeset_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    struct tm* p_tm_ctxt = NULL;
    time_t t_systime_ctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mytimeset_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mytimeset_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            sint32 i_string_len = 0;
            char p_string_buf[32]= {0};

            sint32 i_cur_year = 0;
            sint32 i_cur_month = 0;
            sint32 i_cur_day = 0;
            sint32 i_cur_hour = 0;
            sint32 i_cur_minute = 0;
            sint32 i_cur_second = 0;

            sint08 i_cur_prechar = 0;   
            sint32 i_cur_timezone = 0;

            sint32 i_nb_got = 0;
            uint08 u_shcmd_buf[100];

            if (p_cur_req->it_nb_param != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_mytimeset_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_mytimeset_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            memset(p_string_buf, 0, sizeof(p_string_buf));
            lxz_dstring_get(PARAM1(p_cur_req).pt_str, p_string_buf, sizeof(p_string_buf));
            i_string_len = strlen(p_string_buf);
            if ((i_string_len < 11) || (i_string_len > 17))
            {
                OS_DBG_LOG(("lxzat_dollar_mytimeset_req,i_string_len=%d!\r\n", i_string_len));
                return E_LEC_ERR_P_OTHER;
            }

            i_nb_got = sscanf(p_string_buf,"%ld.%ld.%ld-%ld:%ld:%ld%c%ld", &i_cur_year,&i_cur_month,&i_cur_day,
                &i_cur_hour,&i_cur_minute,&i_cur_second,&i_cur_prechar,&i_cur_timezone);
            if (i_nb_got != 8)
            {
                OS_DBG_LOG(("lxzat_dollar_mytimeset_req,i_nb_got=%d!\r\n", i_nb_got));
                return E_LEC_ERR_P_OTHER;
            }

            if ((i_cur_prechar != '-') && (i_cur_prechar != '+'))
            {
                OS_DBG_LOG(("lxzat_dollar_mytimeset_req,i_cur_prechar=%d!\r\n", i_cur_prechar));
                return E_LEC_ERR_P_RANGE;
            }

            if ((i_cur_timezone < -47) || (i_cur_timezone > 48))
            {
                OS_DBG_LOG(("lxzat_dollar_mytimeget_resp,i_cur_timezone=%d!\r\n", i_cur_timezone));
                return E_LEC_ERR_P_RANGE;
            }

            memset(u_shcmd_buf, 0, sizeof(u_shcmd_buf));
            sprintf(u_shcmd_buf, "busybox date -s \"%ld.%ld.%ld-%ld:%ld:%ld\"", i_cur_year, i_cur_month, i_cur_day,
                    i_cur_hour, i_cur_minute, i_cur_second);
            system(u_shcmd_buf);

            if (i_cur_timezone != 0)
            {
                if (i_cur_prechar == '+')
                {
                    time(&t_systime_ctxt);
                    t_systime_ctxt = t_systime_ctxt - (i_cur_timezone * (3600>>2));
                    p_tm_ctxt = gmtime(&t_systime_ctxt);
                }
                else
                {
                    time(&t_systime_ctxt);
                    t_systime_ctxt = t_systime_ctxt + (i_cur_timezone * (3600>>2));
                    p_tm_ctxt = gmtime(&t_systime_ctxt);
                }
                
                memset(u_shcmd_buf, 0, sizeof(u_shcmd_buf));
                sprintf(u_shcmd_buf, "busybox date -s \"%ld.%ld.%ld-%ld:%ld:%ld\"", i_cur_year, i_cur_month, i_cur_day,
                        i_cur_hour, i_cur_minute, i_cur_second);
                system(u_shcmd_buf);
            }
            
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}


/*
 *  Description:
 *    The response handler of "AT$MYTIMESET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytimeset_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    struct tm* p_tm_ctxt = NULL;
    time_t t_systime_ctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mytimeset_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mytimeset_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            time(&t_systime_ctxt);
            p_tm_ctxt = gmtime(&t_systime_ctxt);
            
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %d.%02d.%02d-%02d:%02d:%02+0",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                p_tm_ctxt->tm_year+1900,
                p_tm_ctxt->tm_mon+1,
                p_tm_ctxt->tm_mday,
                p_tm_ctxt->tm_hour,
                p_tm_ctxt->tm_min,
                p_tm_ctxt->tm_sec);

            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <\"Y.M.D-h:m:s+TZ\">",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYTIMESET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytimeset_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYTIMEGET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytimeget_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYTIMEGET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytimeget_req(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The response handler of "AT$MYTIMEGET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytimeget_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mytimeget_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mytimeget_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            sint32 i_dst_timezone = 0;
            sint32 i_string_len = 0;
            char p_string_buf[32]= {0};
            
            struct tm* p_tm_ctxt = NULL;
            time_t t_systime_ctxt;
            

            if (p_cur_req->it_nb_param != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_mytimeget_resp,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_mytimeget_resp,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            memset(p_string_buf, 0, sizeof(p_string_buf));
            lxz_dstring_get(PARAM1(p_cur_req).pt_str, p_string_buf, sizeof(p_string_buf));
            i_dst_timezone=atoi(p_string_buf);
            if ((i_dst_timezone < -47) || (i_dst_timezone > 48))
            {
                OS_DBG_LOG(("lxzat_dollar_mytimeget_resp,i_dst_timezone=%d!\r\n", i_dst_timezone));
                return E_LEC_ERR_P_RANGE;
            }

            if (i_dst_timezone >= 0)
            {
                time(&t_systime_ctxt);
                t_systime_ctxt = t_systime_ctxt + (i_dst_timezone * (3600>>2));
                p_tm_ctxt = gmtime(&t_systime_ctxt);
                
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: %d.%02d.%02d-%02d:%02d:%02d+%d",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    p_tm_ctxt->tm_year+1900,
                    p_tm_ctxt->tm_mon+1,
                    p_tm_ctxt->tm_mday,
                    p_tm_ctxt->tm_hour,
                    p_tm_ctxt->tm_min,
                    p_tm_ctxt->tm_sec,
                    i_dst_timezone);
            }
            else
            {
                time(&t_systime_ctxt);
                t_systime_ctxt = t_systime_ctxt - (abs(i_dst_timezone) * (3600>>2));
                p_tm_ctxt = gmtime(&t_systime_ctxt);
                
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: %d.%02d.%02d-%02d:%02d:%02d-%d",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    p_tm_ctxt->tm_year+1900,
                    p_tm_ctxt->tm_mon+1,
                    p_tm_ctxt->tm_mday,
                    p_tm_ctxt->tm_hour,
                    p_tm_ctxt->tm_min,
                    p_tm_ctxt->tm_sec,
                    abs(i_dst_timezone));
            }
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <\"TimeZone\">",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}


/*
 *  Description:
 *    The reset handler of "AT$MYTIMEGET".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytimeget_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYTIMENTP".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytimentp_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYTIMENTP".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytimentp_req(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_req_t   * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_nvcfg_t * p_cur_nvcfg = NULL;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mytimentp_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mytimentp_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            sint32 i_peer_port = 123;
            char p_ipaddr_buf[32]= {0};
            uint08 p_shcmd_buf[128];
            
            if (p_cur_req->it_nb_param == 1)
            {
                if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
                {
                    OS_DBG_LOG(("lxzat_dollar_mytimentp_req,param1 type error!\r\n"));
                    return E_LEC_ERR_P_TYPE;
                }

                memset(p_ipaddr_buf, 0, sizeof(p_ipaddr_buf));
                lxz_dstring_get(PARAM1(p_cur_req).pt_str, p_ipaddr_buf, sizeof(p_ipaddr_buf));

                memset(p_shcmd_buf, 0, sizeof(p_shcmd_buf));
                sprintf(p_shcmd_buf, "busybox ntpd -q -p %s", p_ipaddr_buf);
                system(p_shcmd_buf);
            }
            else if (p_cur_req->it_nb_param == 2)
            {
                if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
                {
                    OS_DBG_LOG(("lxzat_dollar_mytimentp_req,param1 type error!\r\n"));
                    return E_LEC_ERR_P_TYPE;
                }
                if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
                {
                    OS_DBG_LOG(("lxzat_dollar_mytimentp_req,param2 type error!\r\n"));
                    return E_LEC_ERR_P_TYPE;
                }

                memset(p_ipaddr_buf, 0, sizeof(p_ipaddr_buf));
                lxz_dstring_get(PARAM1(p_cur_req).pt_str, p_ipaddr_buf, sizeof(p_ipaddr_buf));
                i_peer_port = PARAM2(p_cur_req).it_number;

                memset(p_shcmd_buf, 0, sizeof(p_shcmd_buf));
                sprintf(p_shcmd_buf, "busybox ntpd -q -p %s", p_ipaddr_buf);
                system(p_shcmd_buf);
            }
            else
            {
                OS_DBG_LOG(("lxzat_dollar_mytimentp_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            e_err_code = E_LEC_OK;
            break;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYTIMENTP".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytimentp_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    struct tm* p_tm_ctxt = NULL;
    time_t t_systime_ctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mytimentp_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mytimentp_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            time(&t_systime_ctxt);
            p_tm_ctxt = gmtime(&t_systime_ctxt);
            
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %u,%d.%02d.%02d-%02d:%02d:%02d+0",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                t_systime_ctxt,
                p_tm_ctxt->tm_year+1900,
                p_tm_ctxt->tm_mon+1,
                p_tm_ctxt->tm_mday,
                p_tm_ctxt->tm_hour,
                p_tm_ctxt->tm_min,
                p_tm_ctxt->tm_sec);
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <\"NTPServer\">[,<Port>]",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYTIMENTP".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mytimentp_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYDNSQUERY".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mydnsquery_init(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;

    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_resp_mydnsquery_t * p_resp_mydnsquery = NULL;

    if (p_lxzat_ctxt != NULL)
    {
        p_resp_mydnsquery = (lxzat_resp_mydnsquery_t *)malloc(sizeof(lxzat_resp_mydnsquery_t));
        if (p_resp_mydnsquery != NULL)
        {
            memset(p_resp_mydnsquery, 0, sizeof(lxzat_resp_mydnsquery_t));
            p_lxzat_ctxt->pt_rsp_data = p_resp_mydnsquery;

            e_err_code = E_LEC_OK;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The request handler of "AT$MYDNSQUERY".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mydnsquery_req(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_resp_mydnsquery_t * p_resp_mydnsquery = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mydnsquery_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mydnsquery_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            sint32 i_channel_id = 0;
            sint08 p_ip_buf[LXZAT_IPBUF_SIZE_MAX];
            sint08 p_url_buf[LXZAT_URL_LENGTH_MAX];

            if (p_cur_req->it_nb_param != 2)
            {
                OS_DBG_LOG(("lxzat_dollar_mydnsquery_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }
            
            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_mydnsquery_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }
            
            if (PARAM2_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_mydnsquery_req,param2 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_channel_id = PARAM1(p_cur_req).it_number;
            if(i_channel_id < LXZAT_CHANNEL_ID_MIN || i_channel_id > LXZAT_CHANNEL_ID_MAX)
            {
                OS_DBG_LOG(("lxzat_dollar_mydnsquery_req,i_channel_id=%d\r\n",i_channel_id));
                return E_LEC_ERR_P_RANGE;
            }

            if (LXZAT_TRUE != lxzat_sgcc_ifconfig_f_get(i_channel_id, NULL))
            {
                OS_DBG_LOG(("lxzat_dollar_mydnsquery_req,i_channel_id=%d deactived\r\n",i_channel_id));
                return E_LEC_ERR_NOT_ALLOWED;
            }

            memset(p_url_buf, 0, LXZAT_URL_LENGTH_MAX);
            lxz_dstring_get(PARAM2(p_cur_req).pt_str, p_url_buf, LXZAT_URL_LENGTH_MAX);

            memset(p_ip_buf, 0, LXZAT_IPBUF_SIZE_MAX);
            if(osp_gethostbyname(p_url_buf, p_ip_buf) != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_mydnsquery_req, gethostbyname error\r\n"));
                return E_LEC_SGCC_DNS_TIMEOUT;
            }

            /* step2: find and match, get IP address */
            p_resp_mydnsquery = ((lxzat_resp_mydnsquery_t *)(p_lxzat_ctxt->pt_rsp_data));
            if (p_resp_mydnsquery != NULL)
            {
                p_resp_mydnsquery->i_got_flag = LXZAT_TRUE;
                p_resp_mydnsquery->i_epdp_id = i_channel_id;
                sprintf(p_resp_mydnsquery->u_ipaddr_buf, "%s", p_ip_buf);
            }
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            e_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYDNSQUERY".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mydnsquery_resp(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_resp_mydnsquery_t * p_resp_mydnsquery = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mydnsquery_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mydnsquery_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            p_resp_mydnsquery = ((lxzat_resp_mydnsquery_t *)(p_lxzat_ctxt->pt_rsp_data));
            if (   (p_resp_mydnsquery != NULL)
                && (p_resp_mydnsquery->i_got_flag = LXZAT_TRUE))
            {
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N0,
                    "%s: %d,\"%s\"",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    p_resp_mydnsquery->i_epdp_id,
                    p_resp_mydnsquery->u_ipaddr_buf);
            }
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <ChannelID>,<\"DomainName\">",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            e_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYDNSQUERY".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_mydnsquery_reset(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;

    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_resp_mydnsquery_t * p_resp_mydnsquery = NULL;

    if (p_lxzat_ctxt != NULL)
    {
        p_resp_mydnsquery = ((lxzat_resp_mydnsquery_t *)(p_lxzat_ctxt->pt_rsp_data));
        if (p_resp_mydnsquery != NULL)
        {
            free(p_resp_mydnsquery);
            p_resp_mydnsquery = NULL;

            e_err_code = E_LEC_OK;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYURCSYSINFO".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myurcsysinfo_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYURCSYSINFO".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myurcsysinfo_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myurcsysinfo_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myurcsysinfo_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            sint32 i_new_urctype = 0;

            if (p_cur_req->it_nb_param != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_myurcsysinfo_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            i_new_urctype = PARAM1(p_cur_req).it_number;
            if ((i_new_urctype != 0) && (i_new_urctype != 1))
            {
                OS_DBG_LOG(("lxzat_dollar_myurcsysinfo_req,i_new_urctype=:%d\r\n",i_new_urctype));
                return E_LEC_ERR_P_RANGE;
            }

            gs_myurcsysinfo_urctype = i_new_urctype;
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYURCSYSINFO".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myurcsysinfo_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myurcsysinfo_resp,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myurcsysinfo_resp,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_SGCC_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            sint32 i_cur_urctype = gs_myurcsysinfo_urctype;
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %d",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                i_cur_urctype);

            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <(0-1)>",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);

            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYURCSYSINFO".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myurcsysinfo_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The initialize handler of "AT$MYIPR".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myipr_init(void * pctxt)
{
    return E_LEC_OK;
}

/*
 *  Description:
 *    The request handler of "AT$MYIPR".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myipr_req(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_OK;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_req_t   * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_nvcfg_t * p_cur_nvcfg = NULL;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    sint32 i_new_baudrate = 0;
#if 0
    speed_t s_new_baudrate;
#endif

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myipr_req,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myipr_req,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }
    p_cur_nvcfg = p_cur_spcfg->pt_nv_cfg;
    if(p_cur_nvcfg == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myipr_req,p_cur_spcfg->pt_nv_cfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            if (p_cur_req->it_nb_param != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_myipr_req,i_nb_param=%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }

            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_NUMERIC)
            {
                OS_DBG_LOG(("lxzat_dollar_myipr_req,param1 type error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }

            i_new_baudrate = PARAM1(p_cur_req).it_number;
            if(i_new_baudrate < 0)
            {
                e_err_code = E_LEC_SGCC_PARAM_NOT_CORRECT;
            }
            else
            {
                    sint32 i = 0;
                    e_err_code = E_LEC_SGCC_PARAM_NOT_CORRECT;
                    while(i < LXZAT_SGCC_BAUNDTATE_NUM)
                    {
                        if(i_new_baudrate == gs_sgcc_baundrate_table[i])
                        {
                            struct timeval tv;

                            OS_DBG_LOG(("lxzsp:set baudrate,lock:%d\n", i_new_baudrate));

                            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id, LXZAT_RSP_MODE_P1N1, "OK");
                            lxzat_spcomm_f_flush(p_lxzat_ctxt->it_vsp_id);
                            tv.tv_sec = 0;
                            tv.tv_usec = 20000;
                            select(0, NULL, NULL, NULL, &tv);

                            lxzat_spcomm_baudrate_f_set(p_lxzat_ctxt->it_vsp_id, i_new_baudrate);
                            e_err_code = E_LEC_OK_NOTHING;
                            break;
                        }
                        i++;
                    }
            }
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            e_err_code = E_LEC_OK;
            break;
        }
    }

    return e_err_code;
}

/*
 *  Description:
 *    The response handler of "AT$MYIPR".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myipr_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;

    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;

    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_myipr_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_myipr_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }

    i_req_type = p_cur_req->it_req_type;
    switch (i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            sint32 i_cur_baudrate = lxzat_spcomm_baudrate_f_get(p_lxzat_ctxt->it_vsp_id);

            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: %d",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                i_cur_baudrate);
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: (0,115200,460800,921600)",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
            break;
        }
    default:
        {
            i_err_code = E_LEC_ERR_UNSUPPORTED;
            break;
        }
    }

    return i_err_code;
}

/*
 *  Description:
 *    The reset handler of "AT$MYIPR".
 *  Param: pctxt, the pointer of AT command context;
 *  Return: Operating results;
 *  Note: NONE
 */
static sint32 lxzat_dollar_myipr_reset(void * pctxt)
{
    return E_LEC_OK;
}

/*
*  Description:
*    The initialize handler of "AT$MYNETWGET".
*  Param: pctxt, the pointer of AT command context;
*  Return: Operating results;
*  Note: NONE
*/
static sint32 lxzat_dollar_mynetwget_init(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;
    
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_resp_mynetwget_t * p_resp_mynetwget = NULL;

    if (p_lxzat_ctxt != NULL)
    {
        p_resp_mynetwget = (lxzat_resp_mynetwget_t *)malloc(sizeof(lxzat_resp_mynetwget_t));
        if (p_resp_mynetwget != NULL)
        {
            memset(p_resp_mynetwget, 0, sizeof(lxzat_resp_mynetwget_t));
            p_lxzat_ctxt->pt_rsp_data = p_resp_mynetwget;

            e_err_code = E_LEC_OK;
        }
    }
    
    return e_err_code;
}

/*
*  Description:
*    The request handler of "AT$MYNETWGET".
*  Param: pctxt, the pointer of AT command context;
*  Return: Operating results;
*  Note: NONE
*/
static sint32 lxzat_dollar_mynetwget_req(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;
	
    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
	
    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetwget_req,p_lxzat_ctxt is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }
	
    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetwget_req,p_cur_req or p_cur_spcfg is NULL\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }
	
    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            lxzat_resp_mynetwget_t * p_resp_mynetwget = NULL;

            p_resp_mynetwget = p_lxzat_ctxt->pt_rsp_data;
            if (p_resp_mynetwget == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwget_req,p_resp_mynetwget==NULL\r\n"));
                return E_LEC_ERR_MEM_ADDRESS;
            }

            if (p_cur_req->it_nb_param != 1)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwget_req,i_nb_param:%d\r\n",p_cur_req->it_nb_param));
                return E_LEC_ERR_P_NB_PARAM;
            }
			
            if (PARAM1_TYPE(p_cur_req) != LXZAT_PARAM_TYPE_STRING)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwget_req,PARAM1_TYPE error!\r\n"));
                return E_LEC_ERR_P_TYPE;
            }
			
            break;
        }
    case LXZAT_REQ_TYPE_READ:
        {
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            break;
        }
    default:
        {
            break;
        }
    }
	
    return i_err_code;
}

/*
*  Description:
*    The response handler of "AT$MYNETWGET".
*  Param: pctxt, the pointer of AT command context;
*  Return: Operating results;
*  Note: NONE
*/
static sint32 lxzat_dollar_mynetwget_resp(void * pctxt)
{
    sint32 i_err_code = E_LEC_OK;
	
    sint32 i_req_type = LXZAT_REQ_TYPE_ERR;
    lxzat_req_t * p_cur_req = NULL;
    lxzat_spcfg_t * p_cur_spcfg = NULL;
    lxzdata_info_t * p_cur_datacfg = NULL;
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
	
    sint32 i_id_file = 0;
    sint32 i_nb_read = 0;
    sint32 i_nb_tryread = 0;
    sint32 i_nb_allread = 0;
    sint32 i_file_size = 0;
	
    if (p_lxzat_ctxt == NULL)
    {
        OS_DBG_LOG(("lxzat_dollar_mynetwget_resp,p_lxzat_ctxt is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }
	
    p_cur_req = p_lxzat_ctxt->pt_req_data;
    p_cur_spcfg = lxzat_spcomm_f_get(p_lxzat_ctxt->it_vsp_id);
    if ((p_cur_req == NULL) || (p_cur_spcfg == NULL))
    {
        OS_DBG_LOG(("lxzat_dollar_mynetwget_resp,p_cur_req or p_cur_spcfg is NULL!\r\n"));
        return E_LEC_ERR_UNKNOWN;
    }
	
    i_req_type = p_cur_req->it_req_type;
    switch(i_req_type)
    {
    case LXZAT_REQ_TYPE_SET:
        {
            lxzat_resp_mynetwget_t * p_resp_mynetwget = NULL;
            uint08 ll_buf_data[128];

            p_resp_mynetwget = p_lxzat_ctxt->pt_rsp_data;
            if (p_resp_mynetwget == NULL)
            {
                OS_DBG_LOG(("lxzat_dollar_mynetwget_resp,p_resp_mynetwget==NULL\r\n"));
                return E_LEC_ERR_MEM_ADDRESS;
            }
			
            if (i_file_size > 0)
            {
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N1,
                    "%s: %d",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    i_file_size);

                i_nb_allread = 0;
                while (i_nb_allread < i_file_size)
                {
                    i_nb_tryread = sizeof(ll_buf_data);
                    i_nb_read = osp_socket_f_read(p_resp_mynetwget->it_fd_socket, ll_buf_data, i_nb_tryread);
                    lxzat_rsp_f_printfbin(p_lxzat_ctxt->it_vsp_id,
                        LXZAT_RSP_MODE_P0N0,
                        ll_buf_data,
                        i_nb_read);

                    i_nb_allread = i_nb_allread + i_nb_read;
                }
            }
            else
            {
                lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                    LXZAT_RSP_MODE_P1N1,
                    "%s: %d",
                    p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword,
                    0);
            }
			
            break;
        }
    case LXZAT_REQ_TYPE_TEST:
        {
            lxzat_rsp_f_printf(p_lxzat_ctxt->it_vsp_id,
                LXZAT_RSP_MODE_P1N0,
                "%s: <\"url\">",
                p_lxzat_ctxt->pt_ai_cfg->pt_ai_keyword);
			
            break;
        }
		
    default:
        {
            break;
        }
    }
	
    return i_err_code;
}

/*
*  Description:
*    The reset handler of "AT$MYNETWGET".
*  Param: pctxt, the pointer of AT command context;
*  Return: Operating results;
*  Note: NONE
*/
static sint32 lxzat_dollar_mynetwget_reset(void * pctxt)
{
    LXZAT_ERROR_CODE_E e_err_code = E_LEC_ERR_MEM_NOT_ENOUGH;
    
    lxzat_context_t * p_lxzat_ctxt = (lxzat_context_t *)pctxt;
    lxzat_resp_mynetwget_t * p_resp_mynetwget = NULL;

    if (p_lxzat_ctxt != NULL)
    {
        p_resp_mynetwget = p_lxzat_ctxt->pt_rsp_data;
        if (p_resp_mynetwget != NULL)
        {
            free(p_resp_mynetwget);
            p_resp_mynetwget = NULL;

            e_err_code = E_LEC_OK;
        }
    }
    
    return e_err_code;
}

/*
 *  Description:
 *    new task, rawmode-udpclient task.
 *  Param: i_id_socket, the ID of socket;
 *
 *  Return: NONE.
 */
static sint32 lxzat_task_rawmode_udpclient_newtask(sint32 i_id_socket)
{
    sint32 i_op_status = 0;
    lxzat_task_t *p_new_task = NULL;

    OS_DBG_LOG(("lxzat:lxzat_task_rawmode_udpclient_newtask,entry\r\n"));
    OS_DBG_LOG(("lxzat:lxzat_task_rawmode_udpclient_newtask,i_id_socket=%d\r\n", i_id_socket));
    p_new_task = (lxzat_task_t *)malloc(sizeof(lxzat_task_t));
    if(p_new_task == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_rawmode_udpclient_newtask,p_new_task==NULL!\r\n"));
        return i_op_status;
    }

    i_op_status = 1;
    memset(p_new_task, 0, sizeof(lxzat_task_t));
    p_new_task->fp_exec = lxzat_callback_rawmode_udpclient_f_exec;
    p_new_task->fp_exit = lxzat_callback_rawmode_udpclient_f_exit;
    p_new_task->sparam1 = i_id_socket;
    p_new_task->next = NULL;
    lxzat_task_f_create(p_new_task);

    return i_op_status;
}

/*
 *  Description:
 *    new task, rawmode-tcpclient task.
 *  Param: i_id_socket, the ID of socket;
 *
 *  Return: NONE.
 */
static sint32 lxzat_task_rawmode_tcpclient_newtask(sint32 i_id_socket)
{
    sint32 i_op_status = 0;
    lxzat_task_t *p_new_task = NULL;

    OS_DBG_LOG(("lxzat:lxzat_task_rawmode_tcpclient_newtask,entry\r\n"));
    OS_DBG_LOG(("lxzat:lxzat_task_rawmode_tcpclient_newtask,i_id_socket=%d\r\n", i_id_socket));
    p_new_task = (lxzat_task_t *)malloc(sizeof(lxzat_task_t));
    if(p_new_task == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_rawmode_tcpclient_newtask,p_new_task==NULL!\r\n"));
        return i_op_status;
    }

    i_op_status = 1;
    memset(p_new_task, 0, sizeof(lxzat_task_t));
    p_new_task->fp_exec = lxzat_callback_rawmode_tcpclient_f_exec;
    p_new_task->fp_exit = lxzat_callback_rawmode_tcpclient_f_exit;
    p_new_task->sparam1 = i_id_socket;
    p_new_task->next = NULL;
    lxzat_task_f_create(p_new_task);

    return i_op_status;
}

/*
 *  Description:
 *    new task, udpclient task.
 *  Param: i_id_socket, the ID of socket;
 *
 *  Return: NONE.
 */
static sint32 lxzat_task_udpclient_newtask(sint32 i_id_socket)
{
    sint32 i_op_status = 0;
    lxzat_task_t *p_new_task = NULL;

    OS_DBG_LOG(("lxzat:lxzat_task_udpclient_newtask,entry\r\n"));
    OS_DBG_LOG(("lxzat:lxzat_task_udpclient_newtask,i_id_socket=%d\r\n", i_id_socket));
    p_new_task = (lxzat_task_t *)malloc(sizeof(lxzat_task_t));
    if(p_new_task == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_udpclient_newtask,p_new_task==NULL!\r\n"));
        return i_op_status;
    }

    i_op_status = 1;
    memset(p_new_task, 0, sizeof(lxzat_task_t));
    p_new_task->fp_exec = lxzat_callback_udpclient_f_exec;
    p_new_task->fp_exit = lxzat_callback_udpclient_f_exit;
    p_new_task->sparam2 = i_id_socket;
    p_new_task->next = NULL;
    lxzat_task_f_create(p_new_task);

    return i_op_status;
}

/*
 *  Description:
 *    new task, tcpclient task.
 *  Param: i_id_socket, the ID of socket;
 *
 *  Return: NONE.
 */
static sint32 lxzat_task_tcpclient_newtask(sint32 i_id_socket)
{
    sint32 i_op_status = 0;
    lxzat_task_t *p_new_task = NULL;

    OS_DBG_LOG(("lxzat:lxzat_task_tcpclient_newtask,entry\r\n"));
    OS_DBG_LOG(("lxzat:lxzat_task_tcpclient_newtask,i_id_socket=%d\r\n", i_id_socket));
    p_new_task = (lxzat_task_t *)malloc(sizeof(lxzat_task_t));
    if(p_new_task == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_tcpclient_newtask,p_new_task==NULL!\r\n"));
        return i_op_status;
    }

    i_op_status = 1;
    memset(p_new_task, 0, sizeof(lxzat_task_t));
    p_new_task->fp_exec = lxzat_callback_tcpclient_f_exec;
    p_new_task->fp_exit = lxzat_callback_tcpclient_f_exit;
    p_new_task->sparam1 = i_id_socket;
    p_new_task->next = NULL;
    lxzat_task_f_create(p_new_task);

    return i_op_status;
}

/*
 *  Description:
 *    new task, tcpserver task.
 *  Param: i_id_socket, the ID of socket;
 *
 *  Return: NONE.
 */
static sint32 lxzat_task_tcpserver_newtask(sint32 i_id_socket)
{
    sint32 i_op_status = 0;
    lxzat_task_t *p_new_task = NULL;

    OS_DBG_LOG(("lxzat:lxzat_task_tcpserver_newtask,entry\r\n"));
    OS_DBG_LOG(("lxzat:lxzat_task_tcpserver_newtask,i_id_socket=%d\r\n", i_id_socket));
    p_new_task = (lxzat_task_t *)malloc(sizeof(lxzat_task_t));
    if(p_new_task == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_tcpserver_newtask,p_new_task==NULL!\r\n"));
        return i_op_status;
    }

    i_op_status = 1;
    memset(p_new_task, 0, sizeof(lxzat_task_t));
    p_new_task->fp_exec = lxzat_callback_tcpserver_f_exec;
    p_new_task->fp_exit = lxzat_callback_tcpserver_f_exit;
    p_new_task->sparam1 = i_id_socket;
    p_new_task->next = NULL;
    lxzat_task_f_create(p_new_task);

    return i_op_status;
}

/*
 *  Description:
 *    new task, ftpcmd task.
 *  Param: i_vsp_id, the ID of serial-port;
 *
 *  Return: NONE.
 */
static sint32 lxzat_task_ftpcmd_newtask(sint32 i_vsp_id)
{
    sint32 i_op_status = 0;
    lxzat_task_t *p_new_task = NULL;

    OS_DBG_LOG(("lxzat:lxzat_task_ftpcmd_newtask,entry\r\n"));
    OS_DBG_LOG(("lxzat:lxzat_task_ftpcmd_newtask,i_vsp_id=%d\r\n", i_vsp_id));
    p_new_task = (lxzat_task_t *)malloc(sizeof(lxzat_task_t));
    if(p_new_task == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_ftpcmd_newtask,p_new_task==NULL!\r\n"));
        return i_op_status;
    }

    i_op_status = 1;
    memset(p_new_task, 0, sizeof(lxzat_task_t));
    p_new_task->fp_exec = lxzat_callback_ftpcmd_f_exec;
    p_new_task->fp_exit = lxzat_callback_ftpcmd_f_exit;
    p_new_task->sparam1 = i_vsp_id;
    p_new_task->next = NULL;
    lxzat_task_f_create(p_new_task);

    return i_op_status;
}

/*
 *  Description:
 *    new task, ftpdata task.
 *  Param: i_vsp_id, the ID of serial-port;
 *
 *  Return: NONE.
 */
static sint32 lxzat_task_ftpdata_newtask(sint32 i_vsp_id)
{
    sint32 i_op_status = 0;
    lxzat_task_t *p_new_task = NULL;

    OS_DBG_LOG(("lxzat:lxzat_task_ftpdata_newtask,entry\r\n"));
    OS_DBG_LOG(("lxzat:lxzat_task_ftpdata_newtask,i_vsp_id=%d\r\n", i_vsp_id));
    p_new_task = (lxzat_task_t *)malloc(sizeof(lxzat_task_t));
    if(p_new_task == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_ftpdata_newtask,p_new_task==NULL!\r\n"));
        return i_op_status;
    }

    i_op_status = 1;
    memset(p_new_task, 0, sizeof(lxzat_task_t));
    p_new_task->fp_exec = lxzat_callback_ftpdata_f_exec;
    p_new_task->fp_exit = lxzat_callback_ftpdata_f_exit;
    p_new_task->sparam1 = i_vsp_id;
    p_new_task->next = NULL;
    lxzat_task_f_create(p_new_task);

    return i_op_status;
}

/*
 *  Description:
 *    new task, myurcact task.
 *  Param: i_id_vspctxt, the ID of serial-port;
 *  Param: i_id_vspctxt, the ID of pdp-context;
 *
 *  Return: status of operating.
 */
static sint32 lxzat_task_myurcact_newtask(sint32 i_id_vspctxt, sint32 i_id_pdpctxt)
{
    sint32 i_op_status = 0;

    lxzat_task_t *p_new_task = NULL;
    lxzat_spcfg_t* p_cur_spcfg = NULL;
    lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;

    p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_myurcact_newtask,i_id_vspctxt=%d\r\n", i_id_vspctxt));
        return i_op_status;
    }

    if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
    {
        OS_DBG_LOG(("lxzat:lxzat_task_myurcact_newtask,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
        return i_op_status;
    }

    OS_DBG_LOG(("lxzat:lxzat_task_myurcact_newtask,entry\r\n"));
    OS_DBG_LOG(("lxzat:lxzat_task_myurcact_newtask,i_id_vspctxt=%d,i_id_pdpctxt=%d\r\n", i_id_vspctxt, i_id_pdpctxt));
    p_new_task = (lxzat_task_t *)malloc(sizeof(lxzat_task_t));
    if(p_new_task == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_myurcact_newtask,p_new_task==NULL!\r\n"));
        return i_op_status;
    }

    i_op_status = 1;
    memset(p_new_task, 0, sizeof(lxzat_task_t));
    p_new_task->fp_exec = lxzat_callback_myurcact_f_exec;
    p_new_task->fp_exit = lxzat_callback_myurcact_f_exit;
    p_new_task->sparam1 = i_id_vspctxt;
    p_new_task->sparam2 = i_id_pdpctxt;
    p_new_task->next = NULL;
    lxzat_task_f_create(p_new_task);

    return i_op_status;
}

/*
 *  Description:
 *    new task, myurcdeact task.
 *  Param: i_id_vspctxt, the ID of serial-port;
 *  Param: i_id_vspctxt, the ID of pdp-context;
 *
 *  Return: status of operating.
 */
static sint32 lxzat_task_myurcdeact_newtask(sint32 i_id_vspctxt, sint32 i_id_pdpctxt)
{
    sint32 i_op_status = 0;

    lxzat_task_t *p_new_task = NULL;
    lxzat_spcfg_t* p_cur_spcfg = NULL;
    lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;

    p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_myurcdeact_newtask,i_id_vspctxt=%d\r\n", i_id_vspctxt));
        return i_op_status;
    }

    if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
    {
        OS_DBG_LOG(("lxzat:lxzat_task_myurcdeact_newtask,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
        return i_op_status;
    }

    OS_DBG_LOG(("lxzat:lxzat_task_myurcdeact_newtask,entry\r\n"));
    OS_DBG_LOG(("lxzat:lxzat_task_myurcdeact_newtask,i_id_vspctxt=%d,i_id_pdpctxt=%d\r\n", i_id_vspctxt, i_id_pdpctxt));
    p_new_task = (lxzat_task_t *)malloc(sizeof(lxzat_task_t));
    if(p_new_task == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_myurcdeact_newtask,p_new_task==NULL!\r\n"));
        return i_op_status;
    }

    i_op_status = 1;
    memset(p_new_task, 0, sizeof(lxzat_task_t));
    p_new_task->fp_exec = lxzat_callback_myurcdeact_f_exec;
    p_new_task->fp_exit = lxzat_callback_myurcdeact_f_exit;
    p_new_task->sparam1 = i_id_vspctxt;
    p_new_task->sparam2 = i_id_pdpctxt;
    p_new_task->next = NULL;
    lxzat_task_f_create(p_new_task);

    return i_op_status;
}

/*
 *  Description:
 *    new task, myurcclose task.
 *  Param: i_id_vspctxt, the ID of serial-port;
 *  Param: i_id_vspctxt, the ID of pdp-context;
 *
 *  Return: status of operating.
 */
static sint32 lxzat_task_myurcclose_newtask(sint32 i_id_vspctxt, sint32 i_id_pdpctxt)
{
    sint32 i_op_status = 0;

    lxzat_task_t *p_new_task = NULL;
    lxzat_spcfg_t* p_cur_spcfg = NULL;
    lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;

    p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_myurcclose_newtask,i_id_vspctxt=%d\r\n", i_id_vspctxt));
        return i_op_status;
    }

    if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
    {
        OS_DBG_LOG(("lxzat:lxzat_task_myurcclose_newtask,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
        return i_op_status;
    }

    OS_DBG_LOG(("lxzat:lxzat_task_myurcclose_newtask,entry\r\n"));
    OS_DBG_LOG(("lxzat:lxzat_task_myurcclose_newtask,i_id_vspctxt=%d,i_id_pdpctxt=%d\r\n", i_id_vspctxt, i_id_pdpctxt));
    p_new_task = (lxzat_task_t *)malloc(sizeof(lxzat_task_t));
    if(p_new_task == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_myurcclose_newtask,p_new_task==NULL!\r\n"));
        return i_op_status;
    }

    i_op_status = 1;
    memset(p_new_task, 0, sizeof(lxzat_task_t));
    p_new_task->fp_exec = lxzat_callback_myurcclose_f_exec;
    p_new_task->fp_exit = lxzat_callback_myurcclose_f_exit;
    p_new_task->sparam1 = i_id_vspctxt;
    p_new_task->sparam2 = i_id_pdpctxt;
    p_new_task->next = NULL;
    lxzat_task_f_create(p_new_task);

    return i_op_status;
}

/*
 *  Description:
 *    new task, myurcftp task.
 *  Param: i_id_vspctxt, the ID of serial-port;
 *  Param: i_id_vspctxt, the ID of pdp-context;
 *
 *  Return: status of operating.
 */
static sint32 lxzat_task_myurcftp_newtask(sint32 i_id_vspctxt, sint32 i_id_pdpctxt)
{
    sint32 i_op_status = 0;

    lxzat_task_t *p_new_task = NULL;
    lxzat_spcfg_t* p_cur_spcfg = NULL;
    lxzat_pdpinfo_t* p_cur_pdpinfo = NULL;

    p_cur_spcfg = lxzat_spcomm_f_get(i_id_vspctxt);
    if (p_cur_spcfg == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_myurcftp_newtask,i_id_vspctxt=%d\r\n", i_id_vspctxt));
        return i_op_status;
    }

    if ((i_id_pdpctxt < 0) || (i_id_pdpctxt > 15))
    {
        OS_DBG_LOG(("lxzat:lxzat_task_myurcftp_newtask,i_id_pdpctxt=%d\r\n", i_id_pdpctxt));
        return i_op_status;
    }

    OS_DBG_LOG(("lxzat:lxzat_task_myurcftp_newtask,entry\r\n"));
    OS_DBG_LOG(("lxzat:lxzat_task_myurcftp_newtask,i_id_vspctxt=%d,i_id_pdpctxt=%d\r\n", i_id_vspctxt, i_id_pdpctxt));
    p_new_task = (lxzat_task_t *)malloc(sizeof(lxzat_task_t));
    if(p_new_task == NULL)
    {
        OS_DBG_LOG(("lxzat:lxzat_task_myurcftp_newtask,p_new_task==NULL!\r\n"));
        return i_op_status;
    }

    i_op_status = 1;
    memset(p_new_task, 0, sizeof(lxzat_task_t));
    p_new_task->fp_exec = lxzat_callback_myurcftp_f_exec;
    p_new_task->fp_exit = lxzat_callback_myurcftp_f_exit;
    p_new_task->sparam1 = i_id_vspctxt;
    p_new_task->sparam2 = i_id_pdpctxt;
    p_new_task->next = NULL;
    lxzat_task_f_create(p_new_task);

    return i_op_status;
}
